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

fix: Import types explicitly throughout endo #1864

Closed
wants to merge 3 commits into from

Conversation

kriskowal
Copy link
Member

Description

In the current yarn pack workflow, some type information for export * from '@endo/top-level-name' do not propagate from .js to .d.ts files. To compensate for this, in the publishing process, we must generate all .d.ts files for all packages in order from the least-dependent to most-dependent package, without deleting the generated .d.ts files between packages. This in turn locally breaks the current behavior of import './types.js', where all the types from an exclusively-jsdoc module can be brought into another module’s namespace. This change makes all such imports explicit.


I am working toward getting a working integration with Agoric SDK. We are currently observing TypeScript errors as a consequence of recent work toward eliminating the need to configure TypeScript to traverse an arbitrary depth of node_modules trees to discover type information of transitive dependencies.

The ethos of TypeScript and the performance of type validation depends on each published artifact including .d.ts files that capture the type information gleaned from JSDoc on sister .js files. To that end, recent changes to Endo cause packages to generate these artifacts.

In this workflow, we lose the local ability to import all the type names from a .js file that only contains JSDoc and this is not evident until attempting to generate types from a dependent package. To compensate, we will need to also adjust our publish workflow. All of our prepack and postpack scripts will need to be renamed prepublish and postpublish, such that:

> yarn lerna run prepbublish
> EXISTING PUBLISH WORKFLOW
> yarn lerna run postpublish

This will ensure that all necessary types will be generated correctly across the Endo workspace.

Security Considerations

Scaling Considerations

Documentation Considerations

Testing Considerations

With the new publish workflow, we can no longer rely entirely on yarn lint to discover the problem that this change addresses. To verify this change, one must run yarn lerna run prepack and this must succeed. I’ve altered CI to verify this workflow. We will also need to adjust the agoric-sdk endo sync workflow.

Upgrade Considerations

@kriskowal kriskowal force-pushed the kriskowal-explicit-imports branch from 65292a2 to abf3a34 Compare November 22, 2023 01:11
@kriskowal kriskowal force-pushed the kriskowal-explicit-imports branch from abf3a34 to a4b02a5 Compare November 22, 2023 01:22
@kriskowal
Copy link
Member Author

This landed through a different PR. Closing to clean up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant