Skip to content

Commit bcafdba

Browse files
committed
ESMInterop -> ESModuleInterop, make default for tsc --init
1 parent 7ff11bb commit bcafdba

File tree

23 files changed

+33
-32
lines changed

23 files changed

+33
-32
lines changed

Diff for: src/compiler/checker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1889,7 +1889,7 @@ namespace ts {
18891889
error(moduleReferenceExpression, Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol));
18901890
return symbol;
18911891
}
1892-
if (compilerOptions.ESMInterop) {
1892+
if (compilerOptions.ESModuleInterop) {
18931893
const referenceParent = moduleReferenceExpression.parent;
18941894
if (
18951895
(referenceParent.kind === SyntaxKind.ImportDeclaration && getNamespaceDeclarationNode(referenceParent as ImportDeclaration)) ||

Diff for: src/compiler/commandLineParser.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ namespace ts {
392392
description: Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking
393393
},
394394
{
395-
name: "ESMInterop",
395+
name: "ESModuleInterop",
396396
type: "boolean",
397397
category: Diagnostics.Module_Resolution_Options,
398398
description: Diagnostics.Create_namespace_objects_for_ECMAScript_imports_which_are_neither_callable_nor_constructable_implies_allowSyntheticDefaultImports
@@ -699,7 +699,8 @@ namespace ts {
699699
export const defaultInitCompilerOptions: CompilerOptions = {
700700
module: ModuleKind.CommonJS,
701701
target: ScriptTarget.ES5,
702-
strict: true
702+
strict: true,
703+
ESModuleInterop: true
703704
};
704705

705706
let optionNameMapCache: OptionNameMap;

Diff for: src/compiler/core.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1920,7 +1920,7 @@ namespace ts {
19201920
const moduleKind = getEmitModuleKind(compilerOptions);
19211921
return compilerOptions.allowSyntheticDefaultImports !== undefined
19221922
? compilerOptions.allowSyntheticDefaultImports
1923-
: compilerOptions.ESMInterop
1923+
: compilerOptions.ESModuleInterop
19241924
? !!moduleKind && moduleKind < ModuleKind.ES2015
19251925
: moduleKind === ModuleKind.System;
19261926
}

Diff for: src/compiler/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3820,7 +3820,7 @@ namespace ts {
38203820
typeRoots?: string[];
38213821
/*@internal*/ version?: boolean;
38223822
/*@internal*/ watch?: boolean;
3823-
ESMInterop?: boolean;
3823+
ESModuleInterop?: boolean;
38243824

38253825
[option: string]: CompilerOptionsValue | JsonSourceFile | undefined;
38263826
}

Diff for: tests/baselines/reference/api/tsserverlibrary.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2286,7 +2286,7 @@ declare namespace ts {
22862286
types?: string[];
22872287
/** Paths used to compute primary types search locations */
22882288
typeRoots?: string[];
2289-
ESMInterop?: boolean;
2289+
ESModuleInterop?: boolean;
22902290
[option: string]: CompilerOptionsValue | JsonSourceFile | undefined;
22912291
}
22922292
interface TypeAcquisition {

Diff for: tests/baselines/reference/api/typescript.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2286,7 +2286,7 @@ declare namespace ts {
22862286
types?: string[];
22872287
/** Paths used to compute primary types search locations */
22882288
typeRoots?: string[];
2289-
ESMInterop?: boolean;
2289+
ESModuleInterop?: boolean;
22902290
[option: string]: CompilerOptionsValue | JsonSourceFile | undefined;
22912291
}
22922292
interface TypeAcquisition {

Diff for: tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
2020

2121
/* Strict Type-Checking Options */
22-
"strict": true /* Enable all strict type-checking options. */
22+
"strict": true, /* Enable all strict type-checking options. */
2323
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
2424
// "strictNullChecks": true, /* Enable strict null checks. */
2525
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
@@ -40,7 +40,7 @@
4040
// "typeRoots": [], /* List of folders to include type definitions from. */
4141
// "types": [], /* Type declaration files to be included in compilation. */
4242
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
43-
// "ESMInterop": true, /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
43+
"ESModuleInterop": true /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
4444
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
4545

4646
/* Source Map Options */

Diff for: tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
2828

2929
/* Additional Checks */
30-
"noUnusedLocals": true /* Report errors on unused locals. */
30+
"noUnusedLocals": true, /* Report errors on unused locals. */
3131
// "noUnusedParameters": true, /* Report errors on unused parameters. */
3232
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
3333
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
@@ -40,7 +40,7 @@
4040
// "typeRoots": [], /* List of folders to include type definitions from. */
4141
// "types": [], /* Type declaration files to be included in compilation. */
4242
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
43-
// "ESMInterop": true, /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
43+
"ESModuleInterop": true /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
4444
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
4545

4646
/* Source Map Options */

Diff for: tests/baselines/reference/tsConfig/Initialized TSConfig with enum value compiler options/tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
2020

2121
/* Strict Type-Checking Options */
22-
"strict": true /* Enable all strict type-checking options. */
22+
"strict": true, /* Enable all strict type-checking options. */
2323
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
2424
// "strictNullChecks": true, /* Enable strict null checks. */
2525
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
@@ -40,7 +40,7 @@
4040
// "typeRoots": [], /* List of folders to include type definitions from. */
4141
// "types": [], /* Type declaration files to be included in compilation. */
4242
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
43-
// "ESMInterop": true, /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
43+
"ESModuleInterop": true /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
4444
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
4545

4646
/* Source Map Options */

Diff for: tests/baselines/reference/tsConfig/Initialized TSConfig with files options/tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
2020

2121
/* Strict Type-Checking Options */
22-
"strict": true /* Enable all strict type-checking options. */
22+
"strict": true, /* Enable all strict type-checking options. */
2323
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
2424
// "strictNullChecks": true, /* Enable strict null checks. */
2525
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
@@ -40,7 +40,7 @@
4040
// "typeRoots": [], /* List of folders to include type definitions from. */
4141
// "types": [], /* Type declaration files to be included in compilation. */
4242
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
43-
// "ESMInterop": true, /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
43+
"ESModuleInterop": true /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
4444
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
4545

4646
/* Source Map Options */

Diff for: tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
2020

2121
/* Strict Type-Checking Options */
22-
"strict": true /* Enable all strict type-checking options. */
22+
"strict": true, /* Enable all strict type-checking options. */
2323
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
2424
// "strictNullChecks": true, /* Enable strict null checks. */
2525
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
@@ -40,7 +40,7 @@
4040
// "typeRoots": [], /* List of folders to include type definitions from. */
4141
// "types": [], /* Type declaration files to be included in compilation. */
4242
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
43-
// "ESMInterop": true, /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
43+
"ESModuleInterop": true /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
4444
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
4545

4646
/* Source Map Options */

Diff for: tests/baselines/reference/tsConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
2020

2121
/* Strict Type-Checking Options */
22-
"strict": true /* Enable all strict type-checking options. */
22+
"strict": true, /* Enable all strict type-checking options. */
2323
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
2424
// "strictNullChecks": true, /* Enable strict null checks. */
2525
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
@@ -40,7 +40,7 @@
4040
// "typeRoots": [], /* List of folders to include type definitions from. */
4141
// "types": [], /* Type declaration files to be included in compilation. */
4242
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
43-
// "ESMInterop": true, /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
43+
"ESModuleInterop": true /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
4444
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
4545

4646
/* Source Map Options */

Diff for: tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
2020

2121
/* Strict Type-Checking Options */
22-
"strict": true /* Enable all strict type-checking options. */
22+
"strict": true, /* Enable all strict type-checking options. */
2323
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
2424
// "strictNullChecks": true, /* Enable strict null checks. */
2525
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
@@ -40,7 +40,7 @@
4040
// "typeRoots": [], /* List of folders to include type definitions from. */
4141
// "types": [], /* Type declaration files to be included in compilation. */
4242
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
43-
// "ESMInterop": true, /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
43+
"ESModuleInterop": true /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
4444
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
4545

4646
/* Source Map Options */

Diff for: tests/baselines/reference/tsConfig/Initialized TSConfig with list compiler options/tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
3939
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
4040
// "typeRoots": [], /* List of folders to include type definitions from. */
41-
"types": ["jquery","mocha"] /* Type declaration files to be included in compilation. */
41+
"types": ["jquery","mocha"], /* Type declaration files to be included in compilation. */
4242
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
43-
// "ESMInterop": true, /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
43+
"ESModuleInterop": true /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
4444
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
4545

4646
/* Source Map Options */

Diff for: tests/cases/fourslash/codeFixCalledES2015Import1.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// <reference path='fourslash.ts' />
2-
// @ESMInterop: true
2+
// @ESModuleInterop: true
33
// @Filename: foo.d.ts
44
////declare function foo(): void;
55
////declare namespace foo {}

Diff for: tests/cases/fourslash/codeFixCalledES2015Import2.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// <reference path='fourslash.ts' />
2-
// @ESMInterop: true
2+
// @ESModuleInterop: true
33
// @Filename: foo.d.ts
44
////declare function foo(): void;
55
////declare namespace foo {}

Diff for: tests/cases/fourslash/codeFixCalledES2015Import3.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// <reference path='fourslash.ts' />
2-
// @ESMInterop: true
2+
// @ESModuleInterop: true
33
// @module: amd
44
// @Filename: foo.d.ts
55
////declare function foo(): void;

Diff for: tests/cases/fourslash/codeFixCalledES2015Import4.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// <reference path='fourslash.ts' />
2-
// @ESMInterop: true
2+
// @ESModuleInterop: true
33
// @Filename: foo.d.ts
44
////declare function foo(): void;
55
////declare namespace foo {}

Diff for: tests/cases/fourslash/codeFixCalledES2015Import5.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// <reference path='fourslash.ts' />
2-
// @ESMInterop: true
2+
// @ESModuleInterop: true
33
// @Filename: foo.d.ts
44
////declare function foo(): void;
55
////declare namespace foo {}

Diff for: tests/cases/fourslash/codeFixCalledES2015Import6.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// <reference path='fourslash.ts' />
2-
// @ESMInterop: true
2+
// @ESModuleInterop: true
33
// @module: amd
44
// @Filename: foo.d.ts
55
////declare function foo(): void;

Diff for: tests/cases/fourslash/codeFixCalledES2015Import7.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// <reference path='fourslash.ts' />
2-
// @ESMInterop: true
2+
// @ESModuleInterop: true
33
// @Filename: foo.d.ts
44
////declare class foo(): void;
55
////declare namespace foo {}

Diff for: tests/cases/fourslash/codeFixCalledES2015Import8.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// <reference path='fourslash.ts' />
2-
// @ESMInterop: true
2+
// @ESModuleInterop: true
33
// @Filename: foo.d.ts
44
////declare class foo(): void;
55
////declare namespace foo {}

Diff for: tests/cases/fourslash/codeFixCalledES2015Import9.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// <reference path='fourslash.ts' />
2-
// @ESMInterop: true
2+
// @ESModuleInterop: true
33
// @module: amd
44
// @Filename: foo.d.ts
55
////declare class foo(): void;

0 commit comments

Comments
 (0)