Skip to content

Commit 3b33df0

Browse files
committed
Rename strictESM to ESMInterop
1 parent ebd4c03 commit 3b33df0

File tree

23 files changed

+26
-26
lines changed

23 files changed

+26
-26
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ namespace ts {
6666
const languageVersion = getEmitScriptTarget(compilerOptions);
6767
const modulekind = getEmitModuleKind(compilerOptions);
6868
const noUnusedIdentifiers = !!compilerOptions.noUnusedLocals || !!compilerOptions.noUnusedParameters;
69-
const allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : compilerOptions.strictESM ? (modulekind && modulekind < ModuleKind.ES2015) : modulekind === ModuleKind.System;
69+
const allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : compilerOptions.ESMInterop ? (modulekind && modulekind < ModuleKind.ES2015) : modulekind === ModuleKind.System;
7070
const strictNullChecks = getStrictOptionValue(compilerOptions, "strictNullChecks");
7171
const strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes");
7272
const noImplicitAny = getStrictOptionValue(compilerOptions, "noImplicitAny");
@@ -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.strictESM) {
1892+
if (compilerOptions.ESMInterop) {
18931893
const referenceParent = moduleReferenceExpression.parent;
18941894
if (
18951895
(referenceParent.kind === SyntaxKind.ImportDeclaration && getNamespaceDeclarationNode(referenceParent as ImportDeclaration)) ||

src/compiler/commandLineParser.ts

Lines changed: 1 addition & 1 deletion
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: "strictESM",
395+
name: "ESMInterop",
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

src/compiler/transformers/module/module.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ namespace ts {
639639
}
640640

641641
const promise = createNew(createIdentifier("Promise"), /*typeArguments*/ undefined, [func]);
642-
if (compilerOptions.strictESM) {
642+
if (compilerOptions.ESMInterop) {
643643
context.requestEmitHelper(importStarHelper);
644644
return createCall(createPropertyAccess(promise, createIdentifier("then")), /*typeArguments*/ undefined, [getHelperName("__importStar")]);
645645
}
@@ -654,7 +654,7 @@ namespace ts {
654654
// if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately
655655
const promiseResolveCall = createCall(createPropertyAccess(createIdentifier("Promise"), "resolve"), /*typeArguments*/ undefined, /*argumentsArray*/ []);
656656
let requireCall = createCall(createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []);
657-
if (compilerOptions.strictESM) {
657+
if (compilerOptions.ESMInterop) {
658658
context.requestEmitHelper(importStarHelper);
659659
requireCall = createCall(getHelperName("__importStar"), /*typeArguments*/ undefined, [requireCall]);
660660
}
@@ -692,7 +692,7 @@ namespace ts {
692692

693693

694694
function getHelperExpressionForImport(node: ImportDeclaration, innerExpr: Expression) {
695-
if (!compilerOptions.strictESM || node.transformFlags & TransformFlags.NeverApplyImportHelper) {
695+
if (!compilerOptions.ESMInterop || node.transformFlags & TransformFlags.NeverApplyImportHelper) {
696696
return innerExpr;
697697
}
698698
if (getNamespaceDeclarationNode(node)) {

src/compiler/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3800,7 +3800,7 @@ namespace ts {
38003800
typeRoots?: string[];
38013801
/*@internal*/ version?: boolean;
38023802
/*@internal*/ watch?: boolean;
3803-
strictESM?: boolean;
3803+
ESMInterop?: boolean;
38043804

38053805
[option: string]: CompilerOptionsValue | JsonSourceFile | undefined;
38063806
}

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2285,7 +2285,7 @@ declare namespace ts {
22852285
types?: string[];
22862286
/** Paths used to compute primary types search locations */
22872287
typeRoots?: string[];
2288-
strictESM?: boolean;
2288+
ESMInterop?: boolean;
22892289
[option: string]: CompilerOptionsValue | JsonSourceFile | undefined;
22902290
}
22912291
interface TypeAcquisition {

tests/baselines/reference/api/typescript.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2285,7 +2285,7 @@ declare namespace ts {
22852285
types?: string[];
22862286
/** Paths used to compute primary types search locations */
22872287
typeRoots?: string[];
2288-
strictESM?: boolean;
2288+
ESMInterop?: boolean;
22892289
[option: string]: CompilerOptionsValue | JsonSourceFile | undefined;
22902290
}
22912291
interface TypeAcquisition {

tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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-
// "strictESM": true, /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
43+
// "ESMInterop": 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 */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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-
// "strictESM": true, /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
43+
// "ESMInterop": 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 */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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-
// "strictESM": true, /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
43+
// "ESMInterop": 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 */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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-
// "strictESM": true, /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
43+
// "ESMInterop": 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 */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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-
// "strictESM": true, /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
43+
// "ESMInterop": 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 */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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-
// "strictESM": true, /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
43+
// "ESMInterop": 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 */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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-
// "strictESM": true, /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
43+
// "ESMInterop": 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 */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
// "typeRoots": [], /* List of folders to include type definitions from. */
4141
"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-
// "strictESM": true, /* Create namespace objects for ECMAScript imports which are neither callable nor constructable, implies `allowSyntheticDefaultImports`. */
43+
// "ESMInterop": 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 */

tests/cases/fourslash/codeFixCalledES2015Import1.ts

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

tests/cases/fourslash/codeFixCalledES2015Import2.ts

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

tests/cases/fourslash/codeFixCalledES2015Import3.ts

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

tests/cases/fourslash/codeFixCalledES2015Import4.ts

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

tests/cases/fourslash/codeFixCalledES2015Import5.ts

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

tests/cases/fourslash/codeFixCalledES2015Import6.ts

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

tests/cases/fourslash/codeFixCalledES2015Import7.ts

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

tests/cases/fourslash/codeFixCalledES2015Import8.ts

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

tests/cases/fourslash/codeFixCalledES2015Import9.ts

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

0 commit comments

Comments
 (0)