Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions internal/compiler/program.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,13 @@ func (p *Program) verifyCompilerOptions() {
createRemovedOptionDiagnostic("module", "UMD", "")
}

if options.ESModuleInterop.IsFalse() {
createRemovedOptionDiagnostic("esModuleInterop", "false", "")
}
if options.AllowSyntheticDefaultImports.IsFalse() {
createRemovedOptionDiagnostic("allowSyntheticDefaultImports", "false", "")
}
Comment on lines +694 to +696
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.

if options.StrictPropertyInitialization.IsTrue() && !options.GetStrictOptionValue(options.StrictNullChecks) {
createDiagnosticForOptionName(diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks")
}
Expand Down
2 changes: 1 addition & 1 deletion internal/tsoptions/declscompiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ var optionsForCompiler = []*CommandLineOption{
ShowInSimplifiedHelpView: true,
Category: diagnostics.Interop_Constraints,
Description: diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
DefaultValueDescription: false,
DefaultValueDescription: true,
},
{
Name: "preserveSymlinks",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const m = mod;
}

tsgo --b tests --verbose
ExitStatus:: Success
ExitStatus:: DiagnosticsPresent_OutputsGenerated
Output::
[HH:MM:SS AM] Projects in this build:
* core/tsconfig.json
Expand All @@ -81,6 +81,14 @@ Output::

[HH:MM:SS AM] Building project 'tests/tsconfig.json'...

tests/tsconfig.json:11:28 - error TS5108: Option 'esModuleInterop=false' has been removed. Please remove it from your configuration.

11 "esModuleInterop": false,
   ~~~~~


Found 1 error in tests/tsconfig.json:11

//// [/home/src/tslibs/TS/Lib/lib.es2025.full.d.ts] *Lib*
/// <reference no-default-lib="true"/>
interface Boolean {}
Expand Down Expand Up @@ -310,10 +318,11 @@ import * as mod from '../core/anotherModule';
export const m = mod;

//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo] *new*
{"version":"FakeTSVersion","root":[5],"fileNames":["lib.es2025.full.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","../logic/index.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map","487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n",{"version":"7fa4162f733e6b9e7f7d9d9410e62f61-import * as c from '../core/index';\nimport * as logic from '../logic/index';\n\nc.leftPad(\"\", 10);\nlogic.getSecondsInDay();\n\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"4b3c99afe665034856f74c660f74d6fd-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[3],[2,3,4]],"options":{"composite":true,"declaration":true,"esModuleInterop":false,"skipDefaultLibCheck":true},"referencedMap":[[4,1],[5,2]],"latestChangedDtsFile":"./index.d.ts"}
{"version":"FakeTSVersion","errors":true,"root":[5],"fileNames":["lib.es2025.full.d.ts","../core/index.d.ts","../core/anotherModule.d.ts","../logic/index.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"fc70810d80f598d415c6f21c113a400b-export declare const someString: string;\nexport declare function leftPad(s: string, n: number): string;\nexport declare function multiply(a: number, b: number): number;\n//# sourceMappingURL=index.d.ts.map","5ef600f6f6585506cfe942fc161e76c5-export declare const World = \"hello\";\n//# sourceMappingURL=anotherModule.d.ts.map","487f7216384ec40e22ff7dc40c01be4b-export declare function getSecondsInDay(): number;\nimport * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n",{"version":"7fa4162f733e6b9e7f7d9d9410e62f61-import * as c from '../core/index';\nimport * as logic from '../logic/index';\n\nc.leftPad(\"\", 10);\nlogic.getSecondsInDay();\n\nimport * as mod from '../core/anotherModule';\nexport const m = mod;","signature":"4b3c99afe665034856f74c660f74d6fd-import * as mod from '../core/anotherModule';\nexport declare const m: typeof mod;\n","impliedNodeFormat":1}],"fileIdsList":[[3],[2,3,4]],"options":{"composite":true,"declaration":true,"esModuleInterop":false,"skipDefaultLibCheck":true},"referencedMap":[[4,1],[5,2]],"semanticDiagnosticsPerFile":[1,2,3,4,5],"latestChangedDtsFile":"./index.d.ts"}
//// [/user/username/projects/sample1/tests/tsconfig.tsbuildinfo.readable.baseline.txt] *new*
{
"version": "FakeTSVersion",
"errors": true,
"root": [
{
"files": [
Expand Down Expand Up @@ -398,8 +407,15 @@ export const m = mod;
"../logic/index.d.ts"
]
},
"semanticDiagnosticsPerFile": [
"lib.es2025.full.d.ts",
"../core/index.d.ts",
"../core/anotherModule.d.ts",
"../logic/index.d.ts",
"./index.ts"
],
"latestChangedDtsFile": "./index.d.ts",
"size": 2074
"size": 2129
}

core/tsconfig.json::
Expand All @@ -423,11 +439,11 @@ Signatures::

tests/tsconfig.json::
SemanticDiagnostics::
*refresh* /home/src/tslibs/TS/Lib/lib.es2025.full.d.ts
*refresh* /user/username/projects/sample1/core/index.d.ts
*refresh* /user/username/projects/sample1/core/anotherModule.d.ts
*refresh* /user/username/projects/sample1/logic/index.d.ts
*refresh* /user/username/projects/sample1/tests/index.ts
*not cached* /home/src/tslibs/TS/Lib/lib.es2025.full.d.ts
*not cached* /user/username/projects/sample1/core/index.d.ts
*not cached* /user/username/projects/sample1/core/anotherModule.d.ts
*not cached* /user/username/projects/sample1/logic/index.d.ts
*not cached* /user/username/projects/sample1/tests/index.ts
Signatures::
(stored at emit) /user/username/projects/sample1/tests/index.ts

Expand Down Expand Up @@ -460,7 +476,7 @@ Output::

[HH:MM:SS AM] Project 'logic/tsconfig.json' is up to date because newest input 'logic/index.ts' is older than output 'logic/tsconfig.tsbuildinfo'

[[90mHH:MM:SS AM[0m] Project 'tests/tsconfig.json' is out of date because output 'tests/tsconfig.tsbuildinfo' is older than input 'tests/tsconfig.json'
[[90mHH:MM:SS AM[0m] Project 'tests/tsconfig.json' is out of date because buildinfo file 'tests/tsconfig.tsbuildinfo' indicates that program needs to report errors.

[HH:MM:SS AM] Building project 'tests/tsconfig.json'...

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Specify type package names to be included without being referenced in a source f
--esModuleInterop
Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility.
type: boolean
default: false
default: true

You can learn about all of the compiler options at https://aka.ms/tsc

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Specify type package names to be included without being referenced in a source f
--esModuleInterop
Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility.
type: boolean
default: false
default: true

You can learn about all of the compiler options at https://aka.ms/tsc

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Specify type package names to be included without being referenced in a source f
--esModuleInterop
Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility.
type: boolean
default: false
default: true

You can learn about all of the compiler options at https://aka.ms/tsc

Expand Down
2 changes: 1 addition & 1 deletion testdata/baselines/reference/tsc/commandLine/help-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ default: false
--esModuleInterop
Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility.
type: boolean
default: false
default: true

--forceConsistentCasingInFileNames
Ensure that casing is correct in imports.
Expand Down
2 changes: 1 addition & 1 deletion testdata/baselines/reference/tsc/commandLine/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Specify type package names to be included without being referenced in a source f
--esModuleInterop
Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility.
type: boolean
default: false
default: true

You can learn about all of the compiler options at https://aka.ms/tsc

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Specify type package names to be included without being referenced in a source f
--esModuleInterop
Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility.
type: boolean
default: false
default: true

You can learn about all of the compiler options at https://aka.ms/tsc

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ tsc: The TypeScript Compiler - Version FakeTSVersion

type: boolean

default: false
default: true


You can learn about all of the compiler options at https://aka.ms/tsc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Specify type package names to be included without being referenced in a source f
--esModuleInterop
Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility.
type: boolean
default: false
default: true

You can learn about all of the compiler options at https://aka.ms/tsc

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Specify type package names to be included without being referenced in a source f
--esModuleInterop
Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility.
type: boolean
default: false
default: true

You can learn about all of the compiler options at https://aka.ms/tsc

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Specify type package names to be included without being referenced in a source f
--esModuleInterop
Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility.
type: boolean
default: false
default: true

You can learn about all of the compiler options at https://aka.ms/tsc

Expand Down
Loading