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

restore .d.ts emit for several packages #9189

Merged
merged 4 commits into from
Apr 3, 2024
Merged

restore .d.ts emit for several packages #9189

merged 4 commits into from
Apr 3, 2024

Conversation

turadg
Copy link
Member

@turadg turadg commented Apr 2, 2024

no ticket

Description

@dckc discovered that the Zoe package in NPM no longer had .d.ts files. We bisected it to dbb6522

The --clean made the build command succeed, but stopped actually emitting the files. The motivation for the --clean was to work around the use of /// <reference path in which some packages were reaching into other packages through the filesystem.

The undoes dbb6522 and solves the type resolution problem using the new @import instead of the reference directive. That in turn required making @agoric/governance export explicit types, the way @agoric/ertp was recently made to do.

Security Considerations

n/a

Scaling Considerations

n/a

Documentation Considerations

Nothing for end users

Testing Considerations

  • yarn prepack emits for notifier
  • yarn prepack emits for governance
  • yarn prepack emits for zoe

Upgrade Considerations

does not affect vats

@turadg turadg requested review from kriskowal and dckc April 2, 2024 22:55
Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

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

navigating all the relevant constraints is... quite the tightrope walk.

this is a net win, though, I suppose


// XXX re-export types into global namespace, for consumers that expect these to
// be ambient. Why the _ prefix? Because without it TS gets confused between the
// import and export symbols. h/t https://stackoverflow.com/a/66588974
Copy link
Member

Choose a reason for hiding this comment

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

devious...

This might be a hack as this raises an error if placed inside a .ts file but seems to work when placed inside a .d.ts file.

// XXX re-export types into global namespace, for consumers that expect these to
// be ambient. Why the _ prefix? Because without it TS gets confused between the
// import and export symbols. h/t https://stackoverflow.com/a/66588974
// Note one big downside vs ambients is that these types will appear to be on `globalThis`.
Copy link
Member

Choose a reason for hiding this comment

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

fair price, given that this is a transitional measure.

Is it worth an UNTIL comment?

Comment on lines 1 to 5
// XXX ambient types runtime imports
import '@agoric/ertp/exported.js';
import '@agoric/zoe/src/contractFacet/types-ambient.js';
import '@agoric/zoe/tools/types-ambient.js';
import '@agoric/zoe/src/types.js';
Copy link
Member

Choose a reason for hiding this comment

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

That's an unfortunate regression... but I see those imports are also in agoric-upgrade-13 ... well, a similar list.

fwiw, as of agoric-upgrade-13, the comment at the top cited #6512 ; might be nice to put that back

Comment on lines 7 to 8
"exported.js",
// omit exported.js because 1) it's empty and would overwrite exported.d.ts
// and 2) because it's only for consumption in other packages
Copy link
Member

Choose a reason for hiding this comment

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

I'm a little confused.
"for consumption in other packages" seems like a reason to include it, not a reason to omit it.

Does exported.d.ts suffice somehow when other packages want exported.js?

Copy link
Member Author

Choose a reason for hiding this comment

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

that it's used in other packages is a reason to include it in package.json files. but this is the tsconfig for typechecking this package, so it's superfluous. and because there's a .d.ts it needn't be part of the build. I'll clarify

@turadg turadg added the automerge:rebase Automatically rebase updates, then merge label Apr 3, 2024
@mergify mergify bot merged commit 87eb568 into master Apr 3, 2024
66 checks passed
@mergify mergify bot deleted the ta/fix-zoe-prepack branch April 3, 2024 01:02
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