-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Deprecate esModuleInterop and allowSyntheticDefaultImports (default to true) #62567
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
Deprecate esModuleInterop and allowSyntheticDefaultImports (default to true) #62567
Conversation
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 implements default esModuleInterop and allowSyntheticDefaultImports behavior while deprecating explicit false settings. The changes update TypeScript's module interoperability to behave as if these options are always enabled, which affects how import statements are transpiled to CommonJS.
Key changes:
- Updates module import transpilation to use import helpers by default
- Adds deprecation warnings for explicit false settings of esModuleInterop and allowSyntheticDefaultImports
- Modifies type resolution for dynamic imports to include default export wrappers
Reviewed Changes
Copilot reviewed 300 out of 459 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/baselines/reference/moduleExportAliasImported.types | Updates type expectations for dynamic imports to include default wrapper |
| tests/baselines/reference/moduleAugmentationDoesNamespaceEnumMergeOfReexport.js | Adds import helper functions for namespace imports |
| tests/baselines/reference/mergedDeclarations7.js | Includes __importStar helper for require() calls |
| tests/baselines/reference/legacyNodeModulesExportsSpecifierGenerationConditions.js | Wraps dynamic imports with __importStar helper |
| tests/baselines/reference/keyofModuleObjectHasCorrectKeys.js | Uses __importStar for namespace imports |
| tests/baselines/reference/jsxViaImport.2.js | Adds __importDefault helper for default imports |
| tests/baselines/reference/jsxSpreadFirstUnionNoErrors.js | Uses __importDefault for React import |
| Multiple JSX test files | Consistently use __importStar for React namespace imports |
| Multiple import test files | Add import helper functions and update error messages for deprecated options |
| tests/baselines/reference/importAttributes9.* | Updates dynamic import type resolution |
|
@typescript-bot run dt |
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.
o7
|
I'll fix anything that turns up on DT tomorrow |
|
Hey @jakebailey, the results of running the DT tests are ready. There were interesting changes: Changes are too big to display here, please check the log. |
|
Uh oh |
Closes #62529