mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Add module: es2020 (#33893)
This commit is contained in:
committed by
Daniel Rosenwasser
parent
4c7844be74
commit
deb5288e31
@@ -31598,7 +31598,7 @@ namespace ts {
|
||||
*/
|
||||
function checkClassNameCollisionWithObject(name: Identifier): void {
|
||||
if (languageVersion === ScriptTarget.ES5 && name.escapedText === "Object"
|
||||
&& moduleKind !== ModuleKind.ES2015 && moduleKind !== ModuleKind.ESNext) {
|
||||
&& moduleKind < ModuleKind.ES2015) {
|
||||
error(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]); // https://github.com/Microsoft/TypeScript/issues/17494
|
||||
}
|
||||
}
|
||||
@@ -32763,7 +32763,7 @@ namespace ts {
|
||||
error(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
|
||||
}
|
||||
|
||||
if (moduleKind !== ModuleKind.System && moduleKind !== ModuleKind.ES2015 && moduleKind !== ModuleKind.ESNext) {
|
||||
if (moduleKind !== ModuleKind.System && moduleKind < ModuleKind.ES2015) {
|
||||
checkExternalEmitHelpers(node, ExternalEmitHelpers.ExportStar);
|
||||
}
|
||||
}
|
||||
@@ -35977,7 +35977,9 @@ namespace ts {
|
||||
return grammarErrorOnNode(node.exclamationToken, Diagnostics.Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation);
|
||||
}
|
||||
|
||||
if (compilerOptions.module !== ModuleKind.ES2015 && compilerOptions.module !== ModuleKind.ESNext && compilerOptions.module !== ModuleKind.System && !compilerOptions.noEmit &&
|
||||
const moduleKind = getEmitModuleKind(compilerOptions);
|
||||
|
||||
if (moduleKind < ModuleKind.ES2015 && moduleKind !== ModuleKind.System && !compilerOptions.noEmit &&
|
||||
!(node.parent.parent.flags & NodeFlags.Ambient) && hasModifier(node.parent.parent, ModifierFlags.Export)) {
|
||||
checkESModuleMarker(node.name);
|
||||
}
|
||||
@@ -36323,7 +36325,7 @@ namespace ts {
|
||||
|
||||
function checkGrammarImportCallExpression(node: ImportCall): boolean {
|
||||
if (moduleKind === ModuleKind.ES2015) {
|
||||
return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_esnext_commonjs_amd_system_or_umd);
|
||||
return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system_or_umd);
|
||||
}
|
||||
|
||||
if (node.typeArguments) {
|
||||
|
||||
@@ -304,6 +304,7 @@ namespace ts {
|
||||
umd: ModuleKind.UMD,
|
||||
es6: ModuleKind.ES2015,
|
||||
es2015: ModuleKind.ES2015,
|
||||
es2020: ModuleKind.ES2020,
|
||||
esnext: ModuleKind.ESNext
|
||||
}),
|
||||
affectsModuleResolution: true,
|
||||
|
||||
@@ -911,7 +911,7 @@
|
||||
"category": "Error",
|
||||
"code": 1322
|
||||
},
|
||||
"Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.": {
|
||||
"Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.": {
|
||||
"category": "Error",
|
||||
"code": 1323
|
||||
},
|
||||
|
||||
@@ -1509,8 +1509,7 @@ namespace ts {
|
||||
const moduleKind = getEmitModuleKind(compilerOptions);
|
||||
let create = (hasExportStarsToExportValues || (compilerOptions.esModuleInterop && hasImportStarOrImportDefault))
|
||||
&& moduleKind !== ModuleKind.System
|
||||
&& moduleKind !== ModuleKind.ES2015
|
||||
&& moduleKind !== ModuleKind.ESNext;
|
||||
&& moduleKind < ModuleKind.ES2015;
|
||||
if (!create) {
|
||||
const helpers = getEmitHelpers(node);
|
||||
if (helpers) {
|
||||
|
||||
@@ -3,6 +3,7 @@ namespace ts {
|
||||
function getModuleTransformer(moduleKind: ModuleKind): TransformerFactory<SourceFile | Bundle> {
|
||||
switch (moduleKind) {
|
||||
case ModuleKind.ESNext:
|
||||
case ModuleKind.ES2020:
|
||||
case ModuleKind.ES2015:
|
||||
return transformECMAScriptModule;
|
||||
case ModuleKind.System:
|
||||
|
||||
@@ -2473,6 +2473,7 @@ namespace ts {
|
||||
return isExportOfNamespace(node)
|
||||
|| (isExternalModuleExport(node)
|
||||
&& moduleKind !== ModuleKind.ES2015
|
||||
&& moduleKind !== ModuleKind.ES2020
|
||||
&& moduleKind !== ModuleKind.ESNext
|
||||
&& moduleKind !== ModuleKind.System);
|
||||
}
|
||||
|
||||
@@ -5125,6 +5125,7 @@ namespace ts {
|
||||
// Non-ES module kinds should not come between ES2015 (the earliest ES module kind) and ESNext (the last ES
|
||||
// module kind).
|
||||
ES2015 = 5,
|
||||
ES2020 = 6,
|
||||
ESNext = 99
|
||||
}
|
||||
|
||||
|
||||
@@ -5184,6 +5184,7 @@ namespace ts {
|
||||
case ModuleKind.CommonJS:
|
||||
case ModuleKind.AMD:
|
||||
case ModuleKind.ES2015:
|
||||
case ModuleKind.ES2020:
|
||||
case ModuleKind.ESNext:
|
||||
return true;
|
||||
default:
|
||||
|
||||
@@ -378,6 +378,7 @@ namespace ts.codefix {
|
||||
return ImportKind.Equals;
|
||||
case ModuleKind.System:
|
||||
case ModuleKind.ES2015:
|
||||
case ModuleKind.ES2020:
|
||||
case ModuleKind.ESNext:
|
||||
case ModuleKind.None:
|
||||
// Fall back to the `import * as ns` style import.
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace ts {
|
||||
start: undefined,
|
||||
length: undefined,
|
||||
}, {
|
||||
messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'esnext'.",
|
||||
messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'.",
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
|
||||
|
||||
@@ -2729,6 +2729,7 @@ declare namespace ts {
|
||||
UMD = 3,
|
||||
System = 4,
|
||||
ES2015 = 5,
|
||||
ES2020 = 6,
|
||||
ESNext = 99
|
||||
}
|
||||
export enum JsxEmit {
|
||||
|
||||
@@ -2729,6 +2729,7 @@ declare namespace ts {
|
||||
UMD = 3,
|
||||
System = 4,
|
||||
ES2015 = 5,
|
||||
ES2020 = 6,
|
||||
ESNext = 99
|
||||
}
|
||||
export enum JsxEmit {
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
//// [tests/cases/conformance/dynamicImport/importCallExpression1ESNext.ts] ////
|
||||
//// [tests/cases/conformance/dynamicImport/importCallExpression1ES2020.ts] ////
|
||||
|
||||
//// [0.ts]
|
||||
export function foo() { return "foo"; }
|
||||
@@ -14,7 +14,8 @@ export var p2 = import("./0");
|
||||
|
||||
function foo() {
|
||||
const p2 = import("./0");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [0.js]
|
||||
export function foo() { return "foo"; }
|
||||
+1
@@ -34,3 +34,4 @@ function foo() {
|
||||
>p2 : Symbol(p2, Decl(1.ts, 9, 9))
|
||||
>"./0" : Symbol("tests/cases/conformance/dynamicImport/0", Decl(0.ts, 0, 0))
|
||||
}
|
||||
|
||||
+1
@@ -42,3 +42,4 @@ function foo() {
|
||||
>import("./0") : Promise<typeof import("tests/cases/conformance/dynamicImport/0")>
|
||||
>"./0" : "./0"
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
//// [tests/cases/conformance/dynamicImport/importCallExpression2ESNext.ts] ////
|
||||
//// [tests/cases/conformance/dynamicImport/importCallExpression2ES2020.ts] ////
|
||||
|
||||
//// [0.ts]
|
||||
export class B {
|
||||
@@ -13,7 +13,8 @@ function foo(x: Promise<any>) {
|
||||
})
|
||||
}
|
||||
|
||||
foo(import("./0"));
|
||||
foo(import("./0"));
|
||||
|
||||
|
||||
//// [0.js]
|
||||
export class B {
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
//// [tests/cases/conformance/dynamicImport/importCallExpression3ESNext.ts] ////
|
||||
//// [tests/cases/conformance/dynamicImport/importCallExpression3ES2020.ts] ////
|
||||
|
||||
//// [0.ts]
|
||||
export class B {
|
||||
@@ -11,7 +11,8 @@ async function foo() {
|
||||
var c = new C();
|
||||
c.print();
|
||||
}
|
||||
foo();
|
||||
foo();
|
||||
|
||||
|
||||
//// [0.js]
|
||||
export class B {
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
//// [tests/cases/conformance/dynamicImport/importCallExpression4ESNext.ts] ////
|
||||
//// [tests/cases/conformance/dynamicImport/importCallExpression4ES2020.ts] ////
|
||||
|
||||
//// [0.ts]
|
||||
export class B {
|
||||
@@ -24,7 +24,8 @@ class C {
|
||||
console.log(one.backup());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [0.js]
|
||||
export class B {
|
||||
+1
@@ -65,3 +65,4 @@ class C {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -86,3 +86,4 @@ class C {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -28,4 +28,5 @@ tests/cases/conformance/dynamicImport/2.ts(6,24): error TS7036: Dynamic import's
|
||||
!!! error TS7036: Dynamic import's specifier must be of type 'string', but here has type '"./1" | null'.
|
||||
let myModule3 = import(null);
|
||||
~~~~
|
||||
!!! error TS7036: Dynamic import's specifier must be of type 'string', but here has type 'null'.
|
||||
!!! error TS7036: Dynamic import's specifier must be of type 'string', but here has type 'null'.
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
//// [tests/cases/conformance/dynamicImport/importCallExpression5ESNext.ts] ////
|
||||
//// [tests/cases/conformance/dynamicImport/importCallExpression5ES2020.ts] ////
|
||||
|
||||
//// [0.ts]
|
||||
export class B {
|
||||
@@ -16,7 +16,8 @@ const specify = bar() ? "./0" : undefined;
|
||||
let myModule = import(specify);
|
||||
let myModule1 = import(undefined);
|
||||
let myModule2 = import(bar() ? "./1" : null);
|
||||
let myModule3 = import(null);
|
||||
let myModule3 = import(null);
|
||||
|
||||
|
||||
//// [0.js]
|
||||
export class B {
|
||||
+2
-1
@@ -22,4 +22,5 @@ tests/cases/conformance/dynamicImport/2.ts(6,24): error TS7036: Dynamic import's
|
||||
let myModule2 = import(bar() ? "./1" : null);
|
||||
let myModule3 = import(null);
|
||||
~~~~
|
||||
!!! error TS7036: Dynamic import's specifier must be of type 'string', but here has type 'null'.
|
||||
!!! error TS7036: Dynamic import's specifier must be of type 'string', but here has type 'null'.
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
//// [tests/cases/conformance/dynamicImport/importCallExpression6ESNext.ts] ////
|
||||
//// [tests/cases/conformance/dynamicImport/importCallExpression6ES2020.ts] ////
|
||||
|
||||
//// [0.ts]
|
||||
export class B {
|
||||
@@ -16,7 +16,8 @@ const specify = bar() ? "./0" : undefined;
|
||||
let myModule = import(specify);
|
||||
let myModule1 = import(undefined);
|
||||
let myModule2 = import(bar() ? "./1" : null);
|
||||
let myModule3 = import(null);
|
||||
let myModule3 = import(null);
|
||||
|
||||
|
||||
//// [0.js]
|
||||
export class B {
|
||||
@@ -4,7 +4,8 @@
|
||||
export function foo() { return "foo"; }
|
||||
|
||||
//// [1.ts]
|
||||
var p1 = import("./0");
|
||||
var p1 = import("./0");
|
||||
|
||||
|
||||
//// [0.js]
|
||||
export function foo() { return "foo"; }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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'.
|
||||
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'.
|
||||
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'.
|
||||
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'.
|
||||
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'.
|
||||
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'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/dynamicImport/0.ts (0 errors) ====
|
||||
@@ -9,10 +9,10 @@ tests/cases/conformance/dynamicImport/1.ts(8,16): error TS1323: Dynamic imports
|
||||
==== tests/cases/conformance/dynamicImport/1.ts (3 errors) ====
|
||||
import("./0");
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
|
||||
var p1 = import("./0");
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
|
||||
p1.then(zero => {
|
||||
return zero.foo();
|
||||
})
|
||||
@@ -20,5 +20,5 @@ tests/cases/conformance/dynamicImport/1.ts(8,16): error TS1323: Dynamic imports
|
||||
function foo() {
|
||||
const p2 = import("./0");
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
|
||||
}
|
||||
@@ -8,4 +8,5 @@ tests/cases/conformance/dynamicImport/1.ts(2,1): error TS1109: Expression expect
|
||||
import
|
||||
import { foo } from './0';
|
||||
~~~~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
!!! error TS1109: Expression expected.
|
||||
|
||||
@@ -5,7 +5,8 @@ export function foo() { return "foo"; }
|
||||
|
||||
//// [1.ts]
|
||||
import
|
||||
import { foo } from './0';
|
||||
import { foo } from './0';
|
||||
|
||||
|
||||
//// [0.js]
|
||||
export function foo() { return "foo"; }
|
||||
|
||||
@@ -7,4 +7,5 @@ tests/cases/conformance/dynamicImport/1.ts(1,9): error TS1109: Expression expect
|
||||
==== tests/cases/conformance/dynamicImport/1.ts (1 errors) ====
|
||||
var x = import { foo } from './0';
|
||||
~~~~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
!!! error TS1109: Expression expected.
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
export function foo() { return "foo"; }
|
||||
|
||||
//// [1.ts]
|
||||
var x = import { foo } from './0';
|
||||
var x = import { foo } from './0';
|
||||
|
||||
|
||||
//// [0.js]
|
||||
export function foo() { return "foo"; }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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'.
|
||||
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'.
|
||||
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'.
|
||||
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'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/dynamicImport/foo.ts (0 errors) ====
|
||||
@@ -9,7 +9,7 @@ tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic impo
|
||||
async function foo() {
|
||||
return await import((await import("./foo")).default);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
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'.
|
||||
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'.
|
||||
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'.
|
||||
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'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/dynamicImport/foo.ts (0 errors) ====
|
||||
@@ -9,7 +9,7 @@ tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic impo
|
||||
async function foo() {
|
||||
return await import((await import("./foo")).default);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
|
||||
}
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
//// [tests/cases/conformance/dynamicImport/importCallExpressionNestedESNext.ts] ////
|
||||
//// [tests/cases/conformance/dynamicImport/importCallExpressionNestedES2020.ts] ////
|
||||
|
||||
//// [foo.ts]
|
||||
export default "./foo";
|
||||
@@ -6,7 +6,8 @@ export default "./foo";
|
||||
//// [index.ts]
|
||||
async function foo() {
|
||||
return await import((await import("./foo")).default);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [foo.js]
|
||||
export default "./foo";
|
||||
+1
@@ -10,3 +10,4 @@ async function foo() {
|
||||
>"./foo" : Symbol("tests/cases/conformance/dynamicImport/foo", Decl(foo.ts, 0, 0))
|
||||
>default : Symbol(default, Decl(foo.ts, 0, 0))
|
||||
}
|
||||
|
||||
+1
@@ -15,3 +15,4 @@ async function foo() {
|
||||
>"./foo" : "./foo"
|
||||
>default : "./foo"
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
//// [tests/cases/conformance/dynamicImport/importCallExpressionNestedESNext2.ts] ////
|
||||
//// [tests/cases/conformance/dynamicImport/importCallExpressionNestedES20202.ts] ////
|
||||
|
||||
//// [foo.ts]
|
||||
export default "./foo";
|
||||
@@ -6,7 +6,8 @@ export default "./foo";
|
||||
//// [index.ts]
|
||||
async function foo() {
|
||||
return await import((await import("./foo")).default);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [foo.js]
|
||||
export default "./foo";
|
||||
+1
@@ -10,3 +10,4 @@ async function foo() {
|
||||
>"./foo" : Symbol("tests/cases/conformance/dynamicImport/foo", Decl(foo.ts, 0, 0))
|
||||
>default : Symbol(default, Decl(foo.ts, 0, 0))
|
||||
}
|
||||
|
||||
+1
@@ -15,3 +15,4 @@ async function foo() {
|
||||
>"./foo" : "./foo"
|
||||
>default : "./foo"
|
||||
}
|
||||
|
||||
@@ -6,7 +6,8 @@ import(`./locales/${localeName}.js`).then(bar => {
|
||||
|
||||
import("./locales/" + localeName + ".js").then(bar => {
|
||||
let x = bar;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//// [importCallExpressionShouldNotGetParen.js]
|
||||
const localeName = "zh-CN";
|
||||
|
||||
@@ -25,3 +25,4 @@ import("./locales/" + localeName + ".js").then(bar => {
|
||||
>bar : Symbol(bar, Decl(importCallExpressionShouldNotGetParen.ts, 5, 47))
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -37,3 +37,4 @@ import("./locales/" + localeName + ".js").then(bar => {
|
||||
>bar : any
|
||||
|
||||
});
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'esnext'.
|
||||
error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'.
|
||||
|
||||
|
||||
!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'esnext'.
|
||||
!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'.
|
||||
==== file.ts (0 errors) ====
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'esnext'.
|
||||
error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'.
|
||||
|
||||
|
||||
!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'esnext'.
|
||||
!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'.
|
||||
==== file.ts (0 errors) ====
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'esnext'.
|
||||
error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'.
|
||||
|
||||
|
||||
!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'esnext'.
|
||||
!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'.
|
||||
==== file.ts (0 errors) ====
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'esnext'.
|
||||
error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'.
|
||||
|
||||
|
||||
!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'esnext'.
|
||||
!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'.
|
||||
==== file.ts (0 errors) ====
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
// @module: esnext
|
||||
// @target: esnext
|
||||
// @module: es2020
|
||||
// @target: es2020
|
||||
// @filename: 0.ts
|
||||
export function foo() { return "foo"; }
|
||||
|
||||
@@ -14,4 +14,4 @@ export var p2 = import("./0");
|
||||
|
||||
function foo() {
|
||||
const p2 = import("./0");
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
// @module: esnext
|
||||
// @target: esnext
|
||||
// @module: es2020
|
||||
// @target: es2020
|
||||
// @filename: 0.ts
|
||||
export class B {
|
||||
print() { return "I am B"}
|
||||
@@ -13,4 +13,4 @@ function foo(x: Promise<any>) {
|
||||
})
|
||||
}
|
||||
|
||||
foo(import("./0"));
|
||||
foo(import("./0"));
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
// @module: esnext
|
||||
// @target: esnext
|
||||
// @module: es2020
|
||||
// @target: es2020
|
||||
// @filename: 0.ts
|
||||
export class B {
|
||||
print() { return "I am B"}
|
||||
@@ -11,4 +11,4 @@ async function foo() {
|
||||
var c = new C();
|
||||
c.print();
|
||||
}
|
||||
foo();
|
||||
foo();
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
// @lib: esnext
|
||||
// @module: esnext
|
||||
// @target: esnext
|
||||
// @lib: es2020
|
||||
// @module: es2020
|
||||
// @target: es2020
|
||||
// @filename: 0.ts
|
||||
export class B {
|
||||
print() { return "I am B"}
|
||||
@@ -25,4 +25,4 @@ class C {
|
||||
console.log(one.backup());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
// @module: esnext
|
||||
// @target: esnext
|
||||
// @module: es2020
|
||||
// @target: es2020
|
||||
// @strictNullChecks: true
|
||||
// @filename: 0.ts
|
||||
export class B {
|
||||
@@ -17,4 +17,4 @@ const specify = bar() ? "./0" : undefined;
|
||||
let myModule = import(specify);
|
||||
let myModule1 = import(undefined);
|
||||
let myModule2 = import(bar() ? "./1" : null);
|
||||
let myModule3 = import(null);
|
||||
let myModule3 = import(null);
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
// @module: esnext
|
||||
// @target: esnext
|
||||
// @module: es2020
|
||||
// @target: es2020
|
||||
// @filename: 0.ts
|
||||
export class B {
|
||||
print() { return "I am B"}
|
||||
@@ -16,4 +16,4 @@ const specify = bar() ? "./0" : undefined;
|
||||
let myModule = import(specify);
|
||||
let myModule1 = import(undefined);
|
||||
let myModule2 = import(bar() ? "./1" : null);
|
||||
let myModule3 = import(null);
|
||||
let myModule3 = import(null);
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
// @module: esnext
|
||||
// @target: esnext
|
||||
// @module: es2020
|
||||
// @target: es2020
|
||||
// @filename: test.ts
|
||||
export async function fn() {
|
||||
const req = await import('./test') // ONE
|
||||
@@ -1,9 +1,9 @@
|
||||
// @module: esnext
|
||||
// @target: esnext
|
||||
// @module: es2020
|
||||
// @target: es2020
|
||||
// @declaration: true
|
||||
|
||||
// @filename: 0.ts
|
||||
export function foo() { return "foo"; }
|
||||
|
||||
// @filename: 1.ts
|
||||
var p1 = import("./0");
|
||||
var p1 = import("./0");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// @module: esnext
|
||||
// @target: esnext
|
||||
// @module: es2020
|
||||
// @target: es2020
|
||||
// @declaration: true
|
||||
|
||||
// @filename: 0.ts
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// @module: esnext
|
||||
// @target: esnext
|
||||
// @module: es2020
|
||||
// @target: es2020
|
||||
// @filename: 0.ts
|
||||
export function foo() { return "foo"; }
|
||||
|
||||
// @filename: 1.ts
|
||||
import
|
||||
import { foo } from './0';
|
||||
import { foo } from './0';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// @module: esnext
|
||||
// @target: esnext
|
||||
// @module: es2020
|
||||
// @target: es2020
|
||||
// @filename: 0.ts
|
||||
export function foo() { return "foo"; }
|
||||
|
||||
// @filename: 1.ts
|
||||
var x = import { foo } from './0';
|
||||
var x = import { foo } from './0';
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// @module: esnext
|
||||
// @module: es2020
|
||||
// @target: es6
|
||||
// @skipLibCheck: true
|
||||
// @lib: es6
|
||||
@@ -8,4 +8,4 @@ export default "./foo";
|
||||
// @filename: index.ts
|
||||
async function foo() {
|
||||
return await import((await import("./foo")).default);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// @module: esnext
|
||||
// @module: es2020
|
||||
// @target: es5
|
||||
// @skipLibCheck: true
|
||||
// @lib: es6
|
||||
@@ -8,4 +8,4 @@ export default "./foo";
|
||||
// @filename: index.ts
|
||||
async function foo() {
|
||||
return await import((await import("./foo")).default);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// @module: esnext
|
||||
// @module: es2020
|
||||
// @target: es6
|
||||
// @noImplicitAny: true
|
||||
const localeName = "zh-CN";
|
||||
@@ -8,4 +8,4 @@ import(`./locales/${localeName}.js`).then(bar => {
|
||||
|
||||
import("./locales/" + localeName + ".js").then(bar => {
|
||||
let x = bar;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user