Skip to content

Commit deb5288

Browse files
saschanazDanielRosenwasser
authored andcommitted
Add module: es2020 (#33893)
1 parent 4c7844b commit deb5288

File tree

70 files changed

+127
-92
lines changed

Some content is hidden

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

70 files changed

+127
-92
lines changed

src/compiler/checker.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31598,7 +31598,7 @@ namespace ts {
3159831598
*/
3159931599
function checkClassNameCollisionWithObject(name: Identifier): void {
3160031600
if (languageVersion === ScriptTarget.ES5 && name.escapedText === "Object"
31601-
&& moduleKind !== ModuleKind.ES2015 && moduleKind !== ModuleKind.ESNext) {
31601+
&& moduleKind < ModuleKind.ES2015) {
3160231602
error(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]); // https://github.com/Microsoft/TypeScript/issues/17494
3160331603
}
3160431604
}
@@ -32763,7 +32763,7 @@ namespace ts {
3276332763
error(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
3276432764
}
3276532765

32766-
if (moduleKind !== ModuleKind.System && moduleKind !== ModuleKind.ES2015 && moduleKind !== ModuleKind.ESNext) {
32766+
if (moduleKind !== ModuleKind.System && moduleKind < ModuleKind.ES2015) {
3276732767
checkExternalEmitHelpers(node, ExternalEmitHelpers.ExportStar);
3276832768
}
3276932769
}
@@ -35977,7 +35977,9 @@ namespace ts {
3597735977
return grammarErrorOnNode(node.exclamationToken, Diagnostics.Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation);
3597835978
}
3597935979

35980-
if (compilerOptions.module !== ModuleKind.ES2015 && compilerOptions.module !== ModuleKind.ESNext && compilerOptions.module !== ModuleKind.System && !compilerOptions.noEmit &&
35980+
const moduleKind = getEmitModuleKind(compilerOptions);
35981+
35982+
if (moduleKind < ModuleKind.ES2015 && moduleKind !== ModuleKind.System && !compilerOptions.noEmit &&
3598135983
!(node.parent.parent.flags & NodeFlags.Ambient) && hasModifier(node.parent.parent, ModifierFlags.Export)) {
3598235984
checkESModuleMarker(node.name);
3598335985
}
@@ -36323,7 +36325,7 @@ namespace ts {
3632336325

3632436326
function checkGrammarImportCallExpression(node: ImportCall): boolean {
3632536327
if (moduleKind === ModuleKind.ES2015) {
36326-
return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_esnext_commonjs_amd_system_or_umd);
36328+
return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system_or_umd);
3632736329
}
3632836330

3632936331
if (node.typeArguments) {

src/compiler/commandLineParser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ namespace ts {
304304
umd: ModuleKind.UMD,
305305
es6: ModuleKind.ES2015,
306306
es2015: ModuleKind.ES2015,
307+
es2020: ModuleKind.ES2020,
307308
esnext: ModuleKind.ESNext
308309
}),
309310
affectsModuleResolution: true,

src/compiler/diagnosticMessages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@
911911
"category": "Error",
912912
"code": 1322
913913
},
914-
"Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.": {
914+
"Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.": {
915915
"category": "Error",
916916
"code": 1323
917917
},

src/compiler/factory.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,8 +1509,7 @@ namespace ts {
15091509
const moduleKind = getEmitModuleKind(compilerOptions);
15101510
let create = (hasExportStarsToExportValues || (compilerOptions.esModuleInterop && hasImportStarOrImportDefault))
15111511
&& moduleKind !== ModuleKind.System
1512-
&& moduleKind !== ModuleKind.ES2015
1513-
&& moduleKind !== ModuleKind.ESNext;
1512+
&& moduleKind < ModuleKind.ES2015;
15141513
if (!create) {
15151514
const helpers = getEmitHelpers(node);
15161515
if (helpers) {

src/compiler/transformer.ts

Lines changed: 1 addition & 0 deletions
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 transformECMAScriptModule;
89
case ModuleKind.System:

src/compiler/transformers/ts.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,6 +2473,7 @@ namespace ts {
24732473
return isExportOfNamespace(node)
24742474
|| (isExternalModuleExport(node)
24752475
&& moduleKind !== ModuleKind.ES2015
2476+
&& moduleKind !== ModuleKind.ES2020
24762477
&& moduleKind !== ModuleKind.ESNext
24772478
&& moduleKind !== ModuleKind.System);
24782479
}

src/compiler/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5125,6 +5125,7 @@ namespace ts {
51255125
// Non-ES module kinds should not come between ES2015 (the earliest ES module kind) and ESNext (the last ES
51265126
// module kind).
51275127
ES2015 = 5,
5128+
ES2020 = 6,
51285129
ESNext = 99
51295130
}
51305131

src/compiler/utilities.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5184,6 +5184,7 @@ namespace ts {
51845184
case ModuleKind.CommonJS:
51855185
case ModuleKind.AMD:
51865186
case ModuleKind.ES2015:
5187+
case ModuleKind.ES2020:
51875188
case ModuleKind.ESNext:
51885189
return true;
51895190
default:

src/services/codefixes/importFixes.ts

Lines changed: 1 addition & 0 deletions
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.

src/testRunner/unittests/config/commandLineParsing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ namespace ts {
137137
start: undefined,
138138
length: undefined,
139139
}, {
140-
messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'esnext'.",
140+
messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'.",
141141
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
142142
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
143143

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2729,6 +2729,7 @@ declare namespace ts {
27292729
UMD = 3,
27302730
System = 4,
27312731
ES2015 = 5,
2732+
ES2020 = 6,
27322733
ESNext = 99
27332734
}
27342735
export enum JsxEmit {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2729,6 +2729,7 @@ declare namespace ts {
27292729
UMD = 3,
27302730
System = 4,
27312731
ES2015 = 5,
2732+
ES2020 = 6,
27322733
ESNext = 99
27332734
}
27342735
export enum JsxEmit {

tests/baselines/reference/importCallExpression1ESNext.js renamed to tests/baselines/reference/importCallExpression1ES2020.js

Lines changed: 3 additions & 2 deletions
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"; }

tests/baselines/reference/importCallExpression1ESNext.symbols renamed to tests/baselines/reference/importCallExpression1ES2020.symbols

Lines changed: 1 addition & 0 deletions
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+

tests/baselines/reference/importCallExpression1ESNext.types renamed to tests/baselines/reference/importCallExpression1ES2020.types

Lines changed: 1 addition & 0 deletions
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+

tests/baselines/reference/importCallExpression2ESNext.js renamed to tests/baselines/reference/importCallExpression2ES2020.js

Lines changed: 3 additions & 2 deletions
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 {

tests/baselines/reference/importCallExpression3ESNext.js renamed to tests/baselines/reference/importCallExpression3ES2020.js

Lines changed: 3 additions & 2 deletions
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 {

tests/baselines/reference/importCallExpression4ESNext.js renamed to tests/baselines/reference/importCallExpression4ES2020.js

Lines changed: 3 additions & 2 deletions
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 {

tests/baselines/reference/importCallExpression4ESNext.symbols renamed to tests/baselines/reference/importCallExpression4ES2020.symbols

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,4 @@ class C {
6565
});
6666
}
6767
}
68+

tests/baselines/reference/importCallExpression4ESNext.types renamed to tests/baselines/reference/importCallExpression4ES2020.types

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,4 @@ class C {
8686
});
8787
}
8888
}
89+

tests/baselines/reference/importCallExpression5ESNext.errors.txt renamed to tests/baselines/reference/importCallExpression5ES2020.errors.txt

Lines changed: 2 additions & 1 deletion
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+

tests/baselines/reference/importCallExpression5ESNext.js renamed to tests/baselines/reference/importCallExpression5ES2020.js

Lines changed: 3 additions & 2 deletions
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 {

tests/baselines/reference/importCallExpression6ESNext.errors.txt renamed to tests/baselines/reference/importCallExpression6ES2020.errors.txt

Lines changed: 2 additions & 1 deletion
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+

tests/baselines/reference/importCallExpression6ESNext.js renamed to tests/baselines/reference/importCallExpression6ES2020.js

Lines changed: 3 additions & 2 deletions
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 {

tests/baselines/reference/importCallExpressionDeclarationEmit2.js

Lines changed: 2 additions & 1 deletion
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"; }
Lines changed: 6 additions & 6 deletions
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
}

tests/baselines/reference/importCallExpressionIncorrect1.errors.txt

Lines changed: 2 additions & 1 deletion
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+

tests/baselines/reference/importCallExpressionIncorrect1.js

Lines changed: 2 additions & 1 deletion
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"; }

tests/baselines/reference/importCallExpressionIncorrect2.errors.txt

Lines changed: 2 additions & 1 deletion
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+

tests/baselines/reference/importCallExpressionIncorrect2.js

Lines changed: 2 additions & 1 deletion
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"; }
Lines changed: 4 additions & 4 deletions
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
}
Lines changed: 4 additions & 4 deletions
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
}

tests/baselines/reference/importCallExpressionNestedESNext.js renamed to tests/baselines/reference/importCallExpressionNestedES2020.js

Lines changed: 3 additions & 2 deletions
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)