Skip to content

Deprecate esModuleInterop and allowSyntheticDefaultImports (default to true) - #62567

Merged
Andrew Branch (andrewbranch) merged 3 commits into
microsoft:mainfrom
andrewbranch:deprecate-esModuleInterop
Oct 22, 2025
Merged

Deprecate esModuleInterop and allowSyntheticDefaultImports (default to true)#62567
Andrew Branch (andrewbranch) merged 3 commits into
microsoft:mainfrom
andrewbranch:deprecate-esModuleInterop

Conversation

@andrewbranch

Copy link
Copy Markdown
Member

Closes#62529

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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
FileDescription
tests/baselines/reference/moduleExportAliasImported.typesUpdates type expectations for dynamic imports to include default wrapper
tests/baselines/reference/moduleAugmentationDoesNamespaceEnumMergeOfReexport.jsAdds import helper functions for namespace imports
tests/baselines/reference/mergedDeclarations7.jsIncludes __importStar helper for require() calls
tests/baselines/reference/legacyNodeModulesExportsSpecifierGenerationConditions.jsWraps dynamic imports with __importStar helper
tests/baselines/reference/keyofModuleObjectHasCorrectKeys.jsUses __importStar for namespace imports
tests/baselines/reference/jsxViaImport.2.jsAdds __importDefault helper for default imports
tests/baselines/reference/jsxSpreadFirstUnionNoErrors.jsUses __importDefault for React import
Multiple JSX test filesConsistently use __importStar for React namespace imports
Multiple import test filesAdd import helper functions and update error messages for deprecated options
tests/baselines/reference/importAttributes9.*Updates dynamic import type resolution

Comment threadsrc/compiler/utilities.ts
@github-project-automationgithub-project-automationBot moved this from Not started to Needs merge in PR BacklogOct 22, 2025
@jakebailey

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) run dt

@typescript-bot

TypeScript Bot (typescript-bot) commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
run dt✅ Started👀 Results

@jakebaileyJake Bailey (jakebailey) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

o7

@andrewbranch
Andrew Branch (andrewbranch) merged commit f450c1b into microsoft:mainOct 22, 2025
33 checks passed
@github-project-automationgithub-project-automationBot moved this from Needs merge to Done in PR BacklogOct 22, 2025
@andrewbranch

Copy link
Copy Markdown
MemberAuthor

I'll fix anything that turns up on DT tomorrow

@andrewbranch
Andrew Branch (andrewbranch) deleted the deprecate-esModuleInterop branch October 22, 2025 23:50
@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@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.

You can check the log here.

@jakebailey

Copy link
Copy Markdown
Member

Uh oh

@LukeAbby

Copy link
Copy Markdown

Heads up, because there's no issue with "Breaking Change" the only way I discovered this was by having the error and finding this PR. Not sure how big of a deal that is though.

@jakebaileyJake Bailey (jakebailey) added the Breaking Change Would introduce errors in existing code label Dec 15, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: TeamBreaking ChangeWould introduce errors in existing codeFor Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

esModuleInterop and allowSyntheticDefaultImports in TypeScript 6.0+

6 participants

@andrewbranch@jakebailey@typescript-bot@LukeAbby@RyanCavanaugh