Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves CommonJS support in the TypeScript compiler port by making three key changes:
- Permitting multiple
module.exportsassignments and unioning their types - Making JSDoc
@typedefdeclarations available on imports of CJS modules withmodule.exports - Excluding
module.exportsassignments from stricter TypeScriptexport =checking
These changes align Corsa more closely with Strada's behavior and eliminate numerous baseline differences.
Changes:
- Added
mergedExportEqualsfield toModuleSymbolLinksto track merged export types for CJS modules - Updated test baselines to reflect removal of TS1203 errors for
module.exportsassignments - Improved type resolution for CJS modules with multiple exports and typedefs
Reviewed changes
Copilot reviewed 295 out of 295 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/checker/types.go | Added mergedExportEquals field to support merging multiple CJS exports |
| testdata/baselines/reference/submodule/**/*.diff | Removed TS1203 "Export assignment cannot be used when targeting ECMAScript modules" errors for module.exports |
| testdata/baselines/reference/submodule/**/*.types | Updated type information to show proper CJS module export types |
| testdata/baselines/reference/submodule/**/*.symbols | Updated symbol resolution for CJS exports |
| testdata/baselines/reference/conformance/**/*.errors.txt | Removed erroneous TS1203 errors from conformance tests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In this PR:
module.exportsassignments in a file and union the assigned types.@typedefdeclarations available on imports of CJS modules that usemodule.exports.module.exportsassignments from stricter checking of TypeScriptexport =declarations.These changes align Corsa more closely with the current behavior in Strada and eliminate a large number of baseline differences.