fix: Import types explicitly throughout endo #1864
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In the current
yarn pack
workflow, some type information forexport * 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 ofimport './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 ourprepack
andpostpack
scripts will need to be renamedprepublish
andpostpublish
, such that: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 runyarn 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