Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fewer runtime imports for types #8410

Merged
merged 10 commits into from
Oct 2, 2023
Merged

fewer runtime imports for types #8410

merged 10 commits into from
Oct 2, 2023

Conversation

turadg
Copy link
Member

@turadg turadg commented Sep 28, 2023

refs: #6512

Description

To help with #6512 @mhofman suggested triple-slash directives.

That does the trick for a lot of the cases, which are included here. The ones left I had some trouble with and I'll leave for another PR.

Security Considerations

n/a

Scaling Considerations

n/a

Documentation Considerations

We could say that devs should use the triple-slash instead of import for types imports, but it doesn't yet work reliably. So this is just some progress.

Testing Considerations

CI

Upgrade Considerations

Could possibly affect consumers of these packages but can't affect runtime.

Copy link
Member

@mhofman mhofman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OMG amazing! I had tried this locally but ran into a bunch of side-effects where it could no longer find some declarations. If CI passes, I think I'm good getting this merged.

NB: I will always have a fear with changes to ambient types that CI will miss something because we don't have noImplicitAny enabled. I have no idea how to assuage that fear.

@turadg
Copy link
Member Author

turadg commented Sep 29, 2023

always have a fear with changes to ambient types that CI will miss something

Me too. I added some tooling to report code coverage. It didn't go down in any packages, and went up slightly in agoric-cli.

I considered adding it to CI but I'm not ready to support whatever kinks that introduces. For now it helps to run on-demand.

Current coverage:

(massaged from grep -A 1 typeCoverage packages/*/package.json)

packages path coverage
ERTP 90.37
SwingSet 75.26
access-token 83.97
agoric-cli 77.67
assert 100
base-zone 86.48
boot 85.68
builders 67.19
cache 86.81
casting 88.12
cosmic-proto null
cosmic-swingset 79.4
deploy-script-support 79.84
deployment 61.49
governance 83.56
import-manager 82.1
inter-protocol 93.45
internal 92.26
network 76.57
notifier 89.74
pegasus 90.04
same-structure 100
smart-wallet 86.97
solo 68.59
sparse-ints 100
spawner 50
stat-logger 62.06
store 85.52
swing-store 75.52
swingset-liveslots 71.48
swingset-runner 53.14
swingset-xsnap-supervisor 83.64
telemetry 87.55
time 86.95
vat-data 98.23
vats 90.86
vm-config 100
xsnap-lockdown 73.51
xsnap 94.43
zoe 81.5
zone 96.33

@turadg turadg added the automerge:rebase Automatically rebase updates, then merge label Sep 29, 2023
@github-actions
Copy link

@turadg - This PR appears to be stuck. It's had a merge label for > 24 hours

1 similar comment
@github-actions
Copy link

github-actions bot commented Oct 2, 2023

@turadg - This PR appears to be stuck. It's had a merge label for > 24 hours

The postpack of a previous package only cleans up files in that package. Its prepack may build files in other packages that it doesn't clean up.
The remants were causing errors like:
```
> @agoric/[email protected] prepack /home/runner/work/agoric-sdk/agoric-sdk/packages/governance
> echo "export {}; " | cat - src/types-ambient.js > src/types.js && tsc --build tsconfig.build.json

error TS5055: Cannot write file '/home/runner/work/agoric-sdk/agoric-sdk/packages/ERTP/exported.d.ts' because it would overwrite input file.
```
(in 'https://github.com/Agoric/agoric-sdk/actions/runs/6346051963/job/17239010386?pr=8410'\)

This makes the build clean up files in the way.
@mergify mergify bot merged commit afcbcd7 into master Oct 2, 2023
71 checks passed
@mergify mergify bot deleted the 6512-triple-slash branch October 2, 2023 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants