Error on esModuleInterop=false and allowSyntheticDefaultImports=false (removed in TS7)#2759
Open
Error on esModuleInterop=false and allowSyntheticDefaultImports=false (removed in TS7)#2759
Conversation
…efaultImports=false Change esModuleInterop default to true and add removed option diagnostics for esModuleInterop=false and allowSyntheticDefaultImports=false in verifyCompilerOptions, matching the pattern used for other options removed in TS7. Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement error handling for deprecated compiler options
Error on esModuleInterop=false and allowSyntheticDefaultImports=false (removed in TS7)
Feb 11, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Ports TypeScript#62567 by aligning tsgo’s handling of esModuleInterop / allowSyntheticDefaultImports with TS7 semantics: these options are effectively always true, and explicitly setting them to false is treated as a removed-option error.
Changes:
- Updated
esModuleInterophelp/default display todefault: true. - Added TS5108 “option has been removed” diagnostics when
esModuleInterop=falseorallowSyntheticDefaultImports=falseis explicitly set. - Refreshed multiple reference baselines affected by the help text and the new diagnostic.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
internal/tsoptions/declscompiler.go |
Changes esModuleInterop default value description to true for --help output. |
internal/compiler/program.go |
Emits TS5108 removed-option diagnostics when either option is explicitly set to false. |
testdata/baselines/reference/** |
Updates baselines for help output and tsbuild behavior reflecting the new diagnostics/default display. |
Comment on lines
+694
to
+696
| if options.AllowSyntheticDefaultImports.IsFalse() { | ||
| createRemovedOptionDiagnostic("allowSyntheticDefaultImports", "false", "") | ||
| } |
There was a problem hiding this comment.
The PR adds a removed-option diagnostic for allowSyntheticDefaultImports=false, but the updated baselines only cover the esModuleInterop=false error path. Please add a baseline/test case that exercises allowSyntheticDefaultImports=false (e.g., a small tsbuild/tsc config) so this behavior is covered and won’t regress silently.
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.
Ports TypeScript#62567. Rather than deprecating
esModuleInteropandallowSyntheticDefaultImports, these are treated as removed when set tofalse, consistent with other TS7 removals (baseUrl,outFile,module: AMD/System/UMD).internal/tsoptions/declscompiler.go:esModuleInteropdefault changed fromfalsetotrue(allowSyntheticDefaultImportswas alreadytrue)internal/compiler/program.go: AddedcreateRemovedOptionDiagnosticforesModuleInterop=falseandallowSyntheticDefaultImports=falseinverifyCompilerOptionsGetESModuleInterop()andGetAllowSyntheticDefaultImports()already unconditionally returntrue.💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.