Skip to content

Commit 2ff47c7

Browse files
committed
Add module: es2020
1 parent 196c0aa commit 2ff47c7

File tree

68 files changed

+123
-88
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+123
-88
lines changed

Diff for: src/compiler/checker.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -31437,7 +31437,7 @@ namespace ts {
3143731437
*/
3143831438
function checkClassNameCollisionWithObject(name: Identifier): void {
3143931439
if (languageVersion === ScriptTarget.ES5 && name.escapedText === "Object"
31440-
&& moduleKind !== ModuleKind.ES2015 && moduleKind !== ModuleKind.ESNext) {
31440+
&& moduleKind < ModuleKind.ES2015) {
3144131441
error(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]); // https://github.com/Microsoft/TypeScript/issues/17494
3144231442
}
3144331443
}
@@ -32597,7 +32597,7 @@ namespace ts {
3259732597
error(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
3259832598
}
3259932599

32600-
if (moduleKind !== ModuleKind.System && moduleKind !== ModuleKind.ES2015 && moduleKind !== ModuleKind.ESNext) {
32600+
if (moduleKind !== ModuleKind.System && moduleKind < ModuleKind.ES2015) {
3260132601
checkExternalEmitHelpers(node, ExternalEmitHelpers.ExportStar);
3260232602
}
3260332603
}
@@ -35805,7 +35805,9 @@ namespace ts {
3580535805
return grammarErrorOnNode(node.exclamationToken, Diagnostics.Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation);
3580635806
}
3580735807

35808-
if (compilerOptions.module !== ModuleKind.ES2015 && compilerOptions.module !== ModuleKind.ESNext && compilerOptions.module !== ModuleKind.System && !compilerOptions.noEmit &&
35808+
const moduleKind = getEmitModuleKind(compilerOptions);
35809+
35810+
if (moduleKind < ModuleKind.ES2015 && moduleKind !== ModuleKind.System && !compilerOptions.noEmit &&
3580935811
!(node.parent.parent.flags & NodeFlags.Ambient) && hasModifier(node.parent.parent, ModifierFlags.Export)) {
3581035812
checkESModuleMarker(node.name);
3581135813
}
@@ -36151,7 +36153,7 @@ namespace ts {
3615136153

3615236154
function checkGrammarImportCallExpression(node: ImportCall): boolean {
3615336155
if (moduleKind === ModuleKind.ES2015) {
36154-
return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_esnext_commonjs_amd_system_or_umd);
36156+
return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system_or_umd);
3615536157
}
3615636158

3615736159
if (node.typeArguments) {

Diff for: src/compiler/commandLineParser.ts

+1
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ namespace ts {
261261
umd: ModuleKind.UMD,
262262
es6: ModuleKind.ES2015,
263263
es2015: ModuleKind.ES2015,
264+
es2020: ModuleKind.ES2020,
264265
esnext: ModuleKind.ESNext
265266
}),
266267
affectsModuleResolution: true,

Diff for: src/compiler/diagnosticMessages.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@
903903
"category": "Error",
904904
"code": 1322
905905
},
906-
"Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.": {
906+
"Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.": {
907907
"category": "Error",
908908
"code": 1323
909909
},

Diff for: src/compiler/factory.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -5157,8 +5157,7 @@ namespace ts {
51575157
const moduleKind = getEmitModuleKind(compilerOptions);
51585158
let create = (hasExportStarsToExportValues || (compilerOptions.esModuleInterop && hasImportStarOrImportDefault))
51595159
&& moduleKind !== ModuleKind.System
5160-
&& moduleKind !== ModuleKind.ES2015
5161-
&& moduleKind !== ModuleKind.ESNext;
5160+
&& moduleKind < ModuleKind.ES2015;
51625161
if (!create) {
51635162
const helpers = getEmitHelpers(node);
51645163
if (helpers) {

Diff for: src/compiler/transformer.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ namespace ts {
33
function getModuleTransformer(moduleKind: ModuleKind): TransformerFactory<SourceFile | Bundle> {
44
switch (moduleKind) {
55
case ModuleKind.ESNext:
6+
case ModuleKind.ES2020:
67
case ModuleKind.ES2015:
78
return transformES2015Module;
89
case ModuleKind.System:

Diff for: src/compiler/transformers/ts.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2469,6 +2469,7 @@ namespace ts {
24692469
return isExportOfNamespace(node)
24702470
|| (isExternalModuleExport(node)
24712471
&& moduleKind !== ModuleKind.ES2015
2472+
&& moduleKind !== ModuleKind.ES2020
24722473
&& moduleKind !== ModuleKind.ESNext
24732474
&& moduleKind !== ModuleKind.System);
24742475
}

Diff for: src/compiler/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5054,6 +5054,7 @@ namespace ts {
50545054
// Non-ES module kinds should not come between ES2015 (the earliest ES module kind) and ESNext (the last ES
50555055
// module kind).
50565056
ES2015 = 5,
5057+
ES2020 = 6,
50575058
ESNext = 99
50585059
}
50595060

Diff for: src/compiler/utilities.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7634,6 +7634,7 @@ namespace ts {
76347634
case ModuleKind.CommonJS:
76357635
case ModuleKind.AMD:
76367636
case ModuleKind.ES2015:
7637+
case ModuleKind.ES2020:
76377638
case ModuleKind.ESNext:
76387639
return true;
76397640
default:

Diff for: src/services/codefixes/importFixes.ts

+1
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ namespace ts.codefix {
378378
return ImportKind.Equals;
379379
case ModuleKind.System:
380380
case ModuleKind.ES2015:
381+
case ModuleKind.ES2020:
381382
case ModuleKind.ESNext:
382383
case ModuleKind.None:
383384
// Fall back to the `import * as ns` style import.

Diff for: src/testRunner/unittests/config/commandLineParsing.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ namespace ts {
136136
start: undefined,
137137
length: undefined,
138138
}, {
139-
messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'esnext'.",
139+
messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'.",
140140
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
141141
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
142142

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

+1
Original file line numberDiff line numberDiff line change
@@ -2680,6 +2680,7 @@ declare namespace ts {
26802680
UMD = 3,
26812681
System = 4,
26822682
ES2015 = 5,
2683+
ES2020 = 6,
26832684
ESNext = 99
26842685
}
26852686
export enum JsxEmit {

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

+1
Original file line numberDiff line numberDiff line change
@@ -2680,6 +2680,7 @@ declare namespace ts {
26802680
UMD = 3,
26812681
System = 4,
26822682
ES2015 = 5,
2683+
ES2020 = 6,
26832684
ESNext = 99
26842685
}
26852686
export enum JsxEmit {

Diff for: tests/baselines/reference/importCallExpression1ESNext.js renamed to tests/baselines/reference/importCallExpression1ES2020.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//// [tests/cases/conformance/dynamicImport/importCallExpression1ESNext.ts] ////
1+
//// [tests/cases/conformance/dynamicImport/importCallExpression1ES2020.ts] ////
22

33
//// [0.ts]
44
export function foo() { return "foo"; }
@@ -14,7 +14,8 @@ export var p2 = import("./0");
1414

1515
function foo() {
1616
const p2 = import("./0");
17-
}
17+
}
18+
1819

1920
//// [0.js]
2021
export function foo() { return "foo"; }

Diff for: tests/baselines/reference/importCallExpression1ESNext.symbols renamed to tests/baselines/reference/importCallExpression1ES2020.symbols

+1
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ function foo() {
3434
>p2 : Symbol(p2, Decl(1.ts, 9, 9))
3535
>"./0" : Symbol("tests/cases/conformance/dynamicImport/0", Decl(0.ts, 0, 0))
3636
}
37+

Diff for: tests/baselines/reference/importCallExpression1ESNext.types renamed to tests/baselines/reference/importCallExpression1ES2020.types

+1
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ function foo() {
4242
>import("./0") : Promise<typeof import("tests/cases/conformance/dynamicImport/0")>
4343
>"./0" : "./0"
4444
}
45+

Diff for: tests/baselines/reference/importCallExpression2ESNext.js renamed to tests/baselines/reference/importCallExpression2ES2020.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//// [tests/cases/conformance/dynamicImport/importCallExpression2ESNext.ts] ////
1+
//// [tests/cases/conformance/dynamicImport/importCallExpression2ES2020.ts] ////
22

33
//// [0.ts]
44
export class B {
@@ -13,7 +13,8 @@ function foo(x: Promise<any>) {
1313
})
1414
}
1515

16-
foo(import("./0"));
16+
foo(import("./0"));
17+
1718

1819
//// [0.js]
1920
export class B {

Diff for: tests/baselines/reference/importCallExpression3ESNext.js renamed to tests/baselines/reference/importCallExpression3ES2020.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//// [tests/cases/conformance/dynamicImport/importCallExpression3ESNext.ts] ////
1+
//// [tests/cases/conformance/dynamicImport/importCallExpression3ES2020.ts] ////
22

33
//// [0.ts]
44
export class B {
@@ -11,7 +11,8 @@ async function foo() {
1111
var c = new C();
1212
c.print();
1313
}
14-
foo();
14+
foo();
15+
1516

1617
//// [0.js]
1718
export class B {

Diff for: tests/baselines/reference/importCallExpression4ESNext.js renamed to tests/baselines/reference/importCallExpression4ES2020.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//// [tests/cases/conformance/dynamicImport/importCallExpression4ESNext.ts] ////
1+
//// [tests/cases/conformance/dynamicImport/importCallExpression4ES2020.ts] ////
22

33
//// [0.ts]
44
export class B {
@@ -24,7 +24,8 @@ class C {
2424
console.log(one.backup());
2525
});
2626
}
27-
}
27+
}
28+
2829

2930
//// [0.js]
3031
export class B {

Diff for: tests/baselines/reference/importCallExpression4ESNext.symbols renamed to tests/baselines/reference/importCallExpression4ES2020.symbols

+1
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,4 @@ class C {
6565
});
6666
}
6767
}
68+

Diff for: tests/baselines/reference/importCallExpression4ESNext.types renamed to tests/baselines/reference/importCallExpression4ES2020.types

+1
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,4 @@ class C {
8686
});
8787
}
8888
}
89+

Diff for: tests/baselines/reference/importCallExpression5ESNext.errors.txt renamed to tests/baselines/reference/importCallExpression5ES2020.errors.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ tests/cases/conformance/dynamicImport/2.ts(6,24): error TS7036: Dynamic import's
2828
!!! error TS7036: Dynamic import's specifier must be of type 'string', but here has type '"./1" | null'.
2929
let myModule3 = import(null);
3030
~~~~
31-
!!! error TS7036: Dynamic import's specifier must be of type 'string', but here has type 'null'.
31+
!!! error TS7036: Dynamic import's specifier must be of type 'string', but here has type 'null'.
32+

Diff for: tests/baselines/reference/importCallExpression5ESNext.js renamed to tests/baselines/reference/importCallExpression5ES2020.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//// [tests/cases/conformance/dynamicImport/importCallExpression5ESNext.ts] ////
1+
//// [tests/cases/conformance/dynamicImport/importCallExpression5ES2020.ts] ////
22

33
//// [0.ts]
44
export class B {
@@ -16,7 +16,8 @@ const specify = bar() ? "./0" : undefined;
1616
let myModule = import(specify);
1717
let myModule1 = import(undefined);
1818
let myModule2 = import(bar() ? "./1" : null);
19-
let myModule3 = import(null);
19+
let myModule3 = import(null);
20+
2021

2122
//// [0.js]
2223
export class B {

Diff for: tests/baselines/reference/importCallExpression6ESNext.errors.txt renamed to tests/baselines/reference/importCallExpression6ES2020.errors.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ tests/cases/conformance/dynamicImport/2.ts(6,24): error TS7036: Dynamic import's
2222
let myModule2 = import(bar() ? "./1" : null);
2323
let myModule3 = import(null);
2424
~~~~
25-
!!! error TS7036: Dynamic import's specifier must be of type 'string', but here has type 'null'.
25+
!!! error TS7036: Dynamic import's specifier must be of type 'string', but here has type 'null'.
26+

Diff for: tests/baselines/reference/importCallExpression6ESNext.js renamed to tests/baselines/reference/importCallExpression6ES2020.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//// [tests/cases/conformance/dynamicImport/importCallExpression6ESNext.ts] ////
1+
//// [tests/cases/conformance/dynamicImport/importCallExpression6ES2020.ts] ////
22

33
//// [0.ts]
44
export class B {
@@ -16,7 +16,8 @@ const specify = bar() ? "./0" : undefined;
1616
let myModule = import(specify);
1717
let myModule1 = import(undefined);
1818
let myModule2 = import(bar() ? "./1" : null);
19-
let myModule3 = import(null);
19+
let myModule3 = import(null);
20+
2021

2122
//// [0.js]
2223
export class B {

Diff for: tests/baselines/reference/importCallExpressionDeclarationEmit2.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
export function foo() { return "foo"; }
55

66
//// [1.ts]
7-
var p1 = import("./0");
7+
var p1 = import("./0");
8+
89

910
//// [0.js]
1011
export function foo() { return "foo"; }
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
tests/cases/conformance/dynamicImport/1.ts(1,1): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
2-
tests/cases/conformance/dynamicImport/1.ts(2,10): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
3-
tests/cases/conformance/dynamicImport/1.ts(8,16): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
1+
tests/cases/conformance/dynamicImport/1.ts(1,1): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
2+
tests/cases/conformance/dynamicImport/1.ts(2,10): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
3+
tests/cases/conformance/dynamicImport/1.ts(8,16): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
44

55

66
==== tests/cases/conformance/dynamicImport/0.ts (0 errors) ====
@@ -9,16 +9,16 @@ tests/cases/conformance/dynamicImport/1.ts(8,16): error TS1323: Dynamic imports
99
==== tests/cases/conformance/dynamicImport/1.ts (3 errors) ====
1010
import("./0");
1111
~~~~~~~~~~~~~
12-
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
12+
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
1313
var p1 = import("./0");
1414
~~~~~~~~~~~~~
15-
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
15+
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
1616
p1.then(zero => {
1717
return zero.foo();
1818
})
1919

2020
function foo() {
2121
const p2 = import("./0");
2222
~~~~~~~~~~~~~
23-
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
23+
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
2424
}

Diff for: tests/baselines/reference/importCallExpressionIncorrect1.errors.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ tests/cases/conformance/dynamicImport/1.ts(2,1): error TS1109: Expression expect
88
import
99
import { foo } from './0';
1010
~~~~~~
11-
!!! error TS1109: Expression expected.
11+
!!! error TS1109: Expression expected.
12+

Diff for: tests/baselines/reference/importCallExpressionIncorrect1.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ export function foo() { return "foo"; }
55

66
//// [1.ts]
77
import
8-
import { foo } from './0';
8+
import { foo } from './0';
9+
910

1011
//// [0.js]
1112
export function foo() { return "foo"; }

Diff for: tests/baselines/reference/importCallExpressionIncorrect2.errors.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ tests/cases/conformance/dynamicImport/1.ts(1,9): error TS1109: Expression expect
77
==== tests/cases/conformance/dynamicImport/1.ts (1 errors) ====
88
var x = import { foo } from './0';
99
~~~~~~
10-
!!! error TS1109: Expression expected.
10+
!!! error TS1109: Expression expected.
11+

Diff for: tests/baselines/reference/importCallExpressionIncorrect2.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
export function foo() { return "foo"; }
55

66
//// [1.ts]
7-
var x = import { foo } from './0';
7+
var x = import { foo } from './0';
8+
89

910
//// [0.js]
1011
export function foo() { return "foo"; }
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
tests/cases/conformance/dynamicImport/index.ts(2,18): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
2-
tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
1+
tests/cases/conformance/dynamicImport/index.ts(2,18): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
2+
tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
33

44

55
==== tests/cases/conformance/dynamicImport/foo.ts (0 errors) ====
@@ -9,7 +9,7 @@ tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic impo
99
async function foo() {
1010
return await import((await import("./foo")).default);
1111
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12-
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
12+
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
1313
~~~~~~~~~~~~~~~
14-
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
14+
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
1515
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
tests/cases/conformance/dynamicImport/index.ts(2,18): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
2-
tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
1+
tests/cases/conformance/dynamicImport/index.ts(2,18): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
2+
tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
33

44

55
==== tests/cases/conformance/dynamicImport/foo.ts (0 errors) ====
@@ -9,7 +9,7 @@ tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic impo
99
async function foo() {
1010
return await import((await import("./foo")).default);
1111
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12-
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
12+
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
1313
~~~~~~~~~~~~~~~
14-
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
14+
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
1515
}

Diff for: tests/baselines/reference/importCallExpressionNestedESNext.js renamed to tests/baselines/reference/importCallExpressionNestedES2020.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
//// [tests/cases/conformance/dynamicImport/importCallExpressionNestedESNext.ts] ////
1+
//// [tests/cases/conformance/dynamicImport/importCallExpressionNestedES2020.ts] ////
22

33
//// [foo.ts]
44
export default "./foo";
55

66
//// [index.ts]
77
async function foo() {
88
return await import((await import("./foo")).default);
9-
}
9+
}
10+
1011

1112
//// [foo.js]
1213
export default "./foo";

0 commit comments

Comments
 (0)