-
Notifications
You must be signed in to change notification settings - Fork 734
Fix moduleDetection for node18, fix __esModule in detect=force #2045
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
Conversation
...es/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node18).js.diff
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug in module detection logic for Node18 module kind and refactors the code for better maintainability. The original switch statement inadvertently omitted ModuleKindNode18, causing incorrect module detection behavior.
- Fixed missing
ModuleKindNode18inGetEmitModuleDetectionKind() - Refactored switch statement to range comparison for cleaner code
- Reduced test baseline diffs, indicating better convergence with TypeScript behavior
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
internal/core/compileroptions.go |
Fixed bug where ModuleKindNode18 was missing from module detection logic; refactored switch to range comparison |
testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node18).js.diff |
Reduced diff showing convergence with TypeScript for Node18 module handling |
testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node18).js |
Updated baseline reflecting correct Node18 behavior with __esModule marker |
testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node18).js.diff |
Eliminated diff entirely, indicating full convergence with TypeScript behavior |
testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node18).js |
Updated baseline reflecting correct Node18 module preamble emission |
Probably a typo, plus one
!!!fix.