Add module: es2022 (#44656)

Closes #44653
This commit is contained in:
Kagami Sascha Rosylight
2021-09-29 17:44:57 -07:00
committed by GitHub
parent 5ec836db82
commit 2161e1852f
163 changed files with 2250 additions and 179 deletions
+11 -13
View File
@@ -31110,16 +31110,14 @@ namespace ts {
}
function checkImportMetaProperty(node: MetaProperty) {
if (moduleKind !== ModuleKind.ES2020 && moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.System) {
if (moduleKind === ModuleKind.Node12 || moduleKind === ModuleKind.NodeNext) {
if (getSourceFileOfNode(node).impliedNodeFormat !== ModuleKind.ESNext) {
error(node, Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
}
}
else {
error(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12_or_nodenext);
if (moduleKind === ModuleKind.Node12 || moduleKind === ModuleKind.NodeNext) {
if (getSourceFileOfNode(node).impliedNodeFormat !== ModuleKind.ESNext) {
error(node, Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
}
}
else if (moduleKind < ModuleKind.ES2020 && moduleKind !== ModuleKind.System) {
error(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node12_or_nodenext);
}
const file = getSourceFileOfNode(node);
Debug.assert(!!(file.flags & NodeFlags.PossiblyContainsImportMeta), "Containing file is missing import meta node flag.");
return node.name.escapedText === "meta" ? getGlobalImportMetaType() : errorType;
@@ -32141,10 +32139,10 @@ namespace ts {
Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module);
diagnostics.add(diagnostic);
}
if ((moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.System && !(moduleKind === ModuleKind.NodeNext && getSourceFileOfNode(node).impliedNodeFormat === ModuleKind.ESNext)) || languageVersion < ScriptTarget.ES2017) {
if ((moduleKind !== ModuleKind.ES2022 && moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.System && !(moduleKind === ModuleKind.NodeNext && getSourceFileOfNode(node).impliedNodeFormat === ModuleKind.ESNext)) || languageVersion < ScriptTarget.ES2017) {
span = getSpanOfTokenAtPosition(sourceFile, node.pos);
const diagnostic = createFileDiagnostic(sourceFile, span.start, span.length,
Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher);
Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher);
diagnostics.add(diagnostic);
}
}
@@ -42807,9 +42805,9 @@ namespace ts {
diagnostics.add(createDiagnosticForNode(forInOrOfStatement.awaitModifier,
Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module));
}
if ((moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.System && !(moduleKind === ModuleKind.NodeNext && getSourceFileOfNode(forInOrOfStatement).impliedNodeFormat === ModuleKind.ESNext)) || languageVersion < ScriptTarget.ES2017) {
if ((moduleKind !== ModuleKind.ES2022 && moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.System && !(moduleKind === ModuleKind.NodeNext && getSourceFileOfNode(forInOrOfStatement).impliedNodeFormat === ModuleKind.ESNext)) || languageVersion < ScriptTarget.ES2017) {
diagnostics.add(createDiagnosticForNode(forInOrOfStatement.awaitModifier,
Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher));
Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher));
}
}
}
@@ -43573,7 +43571,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_es2020_esnext_commonjs_amd_system_umd_node12_or_nodenext);
return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node12_or_nodenext);
}
if (node.typeArguments) {
+1
View File
@@ -394,6 +394,7 @@ namespace ts {
es6: ModuleKind.ES2015,
es2015: ModuleKind.ES2015,
es2020: ModuleKind.ES2020,
es2022: ModuleKind.ES2022,
esnext: ModuleKind.ESNext,
node12: ModuleKind.Node12,
nodenext: ModuleKind.NodeNext,
+4 -4
View File
@@ -920,7 +920,7 @@
"category": "Error",
"code": 1322
},
"Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.": {
"Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.": {
"category": "Error",
"code": 1323
},
@@ -992,7 +992,7 @@
"category": "Error",
"code": 1342
},
"The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.": {
"The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.": {
"category": "Error",
"code": 1343
},
@@ -1116,7 +1116,7 @@
"category": "Message",
"code": 1377
},
"Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.": {
"Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.": {
"category": "Error",
"code": 1378
},
@@ -1324,7 +1324,7 @@
"category": "Error",
"code": 1431
},
"Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.": {
"Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.": {
"category": "Error",
"code": 1432
},
+1
View File
@@ -3,6 +3,7 @@ namespace ts {
function getModuleTransformer(moduleKind: ModuleKind): TransformerFactory<SourceFile | Bundle> {
switch (moduleKind) {
case ModuleKind.ESNext:
case ModuleKind.ES2022:
case ModuleKind.ES2020:
case ModuleKind.ES2015:
return transformECMAScriptModule;
+1
View File
@@ -2507,6 +2507,7 @@ namespace ts {
|| (isExternalModuleExport(node)
&& moduleKind !== ModuleKind.ES2015
&& moduleKind !== ModuleKind.ES2020
&& moduleKind !== ModuleKind.ES2022
&& moduleKind !== ModuleKind.ESNext
&& moduleKind !== ModuleKind.System);
}
+1
View File
@@ -6192,6 +6192,7 @@ namespace ts {
// module kind).
ES2015 = 5,
ES2020 = 6,
ES2022 = 7,
ESNext = 99,
// Node12+ is an amalgam of commonjs (albeit updated) and es2020+, and represents a distinct module system from es2020/esnext
+1
View File
@@ -6166,6 +6166,7 @@ namespace ts {
case ModuleKind.AMD:
case ModuleKind.ES2015:
case ModuleKind.ES2020:
case ModuleKind.ES2022:
case ModuleKind.ESNext:
return true;
default:
@@ -2,8 +2,8 @@
namespace ts.codefix {
registerCodeFix({
errorCodes: [
Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
],
getCodeActions: context => {
const compilerOptions = context.program.getCompilerOptions();
+1
View File
@@ -738,6 +738,7 @@ namespace ts.codefix {
case ModuleKind.System:
case ModuleKind.ES2015:
case ModuleKind.ES2020:
case ModuleKind.ES2022:
case ModuleKind.ESNext:
case ModuleKind.None:
// Fall back to the `import * as ns` style import.
@@ -159,7 +159,7 @@ namespace ts {
start: undefined,
length: undefined,
}, {
messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext', 'node12', 'nodenext'.",
messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node12', 'nodenext'.",
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
@@ -184,7 +184,7 @@ namespace ts {
file: undefined,
start: 0,
length: 0,
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', 'es2022', 'esnext'.",
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category
}]
+1
View File
@@ -3025,6 +3025,7 @@ declare namespace ts {
System = 4,
ES2015 = 5,
ES2020 = 6,
ES2022 = 7,
ESNext = 99,
Node12 = 100,
NodeNext = 199
+1
View File
@@ -3025,6 +3025,7 @@ declare namespace ts {
System = 4,
ES2015 = 5,
ES2020 = 6,
ES2022 = 7,
ESNext = 99,
Node12 = 100,
NodeNext = 199
@@ -12,8 +12,8 @@ tests/cases/compiler/awaitInNonAsyncFunction.ts(30,9): error TS1103: 'for await'
tests/cases/compiler/awaitInNonAsyncFunction.ts(31,5): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
tests/cases/compiler/awaitInNonAsyncFunction.ts(34,7): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
tests/cases/compiler/awaitInNonAsyncFunction.ts(35,5): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
tests/cases/compiler/awaitInNonAsyncFunction.ts(39,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/compiler/awaitInNonAsyncFunction.ts(40,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/compiler/awaitInNonAsyncFunction.ts(39,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/compiler/awaitInNonAsyncFunction.ts(40,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
==== tests/cases/compiler/awaitInNonAsyncFunction.ts (16 errors) ====
@@ -97,7 +97,7 @@ tests/cases/compiler/awaitInNonAsyncFunction.ts(40,1): error TS1378: Top-level '
for await (const _ of []);
~~~~~
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
await null;
~~~~~
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
@@ -0,0 +1,24 @@
//// [a.ts]
declare var dec: any, __decorate: any;
@dec export class A {
}
const o = { a: 1 };
const y = { ...o };
//// [a.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
let A = class A {
};
A = __decorate([
dec
], A);
export { A };
const o = { a: 1 };
const y = Object.assign({}, o);
@@ -3,15 +3,15 @@ tests/cases/conformance/importAssertion/1.ts(2,28): error TS2821: Import asserti
tests/cases/conformance/importAssertion/1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/3.ts(1,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(2,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(3,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(4,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(5,12): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(7,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(8,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(9,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(10,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(1,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(2,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(3,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(4,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(5,12): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(7,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(8,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(9,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(10,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
==== tests/cases/conformance/importAssertion/0.ts (0 errors) ====
@@ -48,31 +48,31 @@ tests/cases/conformance/importAssertion/3.ts(10,11): error TS1323: Dynamic impor
==== tests/cases/conformance/importAssertion/3.ts (9 errors) ====
const a = import('./0')
~~~~~~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
const b = import('./0', { assert: { type: "json" } })
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
const d = import('./0', { assert: {} })
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
const dd = import('./0', {})
~~~~~~~~~~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
declare function foo(): any;
const e = import('./0', foo())
~~~~~~~~~~~~~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
const f = import()
~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
const g = import('./0', {}, {})
~~~~~~~~~~~~~~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
const h = import('./0', { assert: { type: "json" }},)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
@@ -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 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
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', 'umd', 'node12', or 'nodenext'.
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', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/dynamicImport/1.ts(1,1): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/dynamicImport/1.ts(2,10): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/dynamicImport/1.ts(8,16): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
==== 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 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
var p1 = import("./0");
~~~~~~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
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 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
}
@@ -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 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
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', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/dynamicImport/index.ts(2,18): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
==== 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 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
~~~~~~~~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
}
@@ -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 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
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', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/dynamicImport/index.ts(2,18): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
==== 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 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
~~~~~~~~~~~~~~~
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
}
@@ -1,25 +1,25 @@
error TS2468: Cannot find global value 'Promise'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,32): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,32): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,44): error TS2339: Property 'blah' does not exist on type 'ImportMeta'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,51): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,51): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,63): error TS2339: Property 'blue' does not exist on type 'ImportMeta'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,70): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,70): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/example.ts(2,2): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option.
tests/cases/conformance/es2019/importMeta/example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/example.ts(6,28): error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'.
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,23): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,23): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(1,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(1,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,22): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
@@ -31,12 +31,12 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
!!! error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option.
const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString());
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
const blob = await response.blob();
const size = import.meta.scriptElement.dataset.size || 300;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
~~~~~~~~~~~~~
!!! error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'.
@@ -50,48 +50,48 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
==== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts (5 errors) ====
export let x = import.meta;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
export let y = import.metal;
~~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
~~~~~
!!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
export let z = import.import.import.malkovich;
~~~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
~~~~~~
!!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
==== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts (5 errors) ====
let globalA = import.meta;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
let globalB = import.metal;
~~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
~~~~~
!!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
let globalC = import.import.import.malkovich;
~~~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
~~~~~~
!!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
==== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts (8 errors) ====
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
~~~~
!!! error TS2339: Property 'blah' does not exist on type 'ImportMeta'.
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
~~~~
!!! error TS2339: Property 'blue' does not exist on type 'ImportMeta'.
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
import.meta = foo;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
~~~~~~~~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
@@ -104,4 +104,4 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
const { a, b, c } = import.meta.wellKnownProperty;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
@@ -1,25 +1,25 @@
error TS2468: Cannot find global value 'Promise'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,32): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,32): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,44): error TS2339: Property 'blah' does not exist on type 'ImportMeta'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,51): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,51): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,63): error TS2339: Property 'blue' does not exist on type 'ImportMeta'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,70): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,70): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/example.ts(2,2): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option.
tests/cases/conformance/es2019/importMeta/example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/example.ts(6,28): error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'.
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,23): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,23): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(1,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(1,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,22): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
@@ -31,12 +31,12 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
!!! error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option.
const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString());
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
const blob = await response.blob();
const size = import.meta.scriptElement.dataset.size || 300;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
~~~~~~~~~~~~~
!!! error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'.
@@ -50,48 +50,48 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
==== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts (5 errors) ====
export let x = import.meta;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
export let y = import.metal;
~~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
~~~~~
!!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
export let z = import.import.import.malkovich;
~~~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
~~~~~~
!!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
==== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts (5 errors) ====
let globalA = import.meta;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
let globalB = import.metal;
~~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
~~~~~
!!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
let globalC = import.import.import.malkovich;
~~~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
~~~~~~
!!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
==== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts (8 errors) ====
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
~~~~
!!! error TS2339: Property 'blah' does not exist on type 'ImportMeta'.
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
~~~~
!!! error TS2339: Property 'blue' does not exist on type 'ImportMeta'.
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
import.meta = foo;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
~~~~~~~~~~~
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
@@ -104,4 +104,4 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
const { a, b, c } = import.meta.wellKnownProperty;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
@@ -1,27 +1,27 @@
tests/cases/conformance/node/allowJs/index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/allowJs/index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/allowJs/subfolder/index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/allowJs/subfolder/index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/allowJs/index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/allowJs/index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/allowJs/subfolder/index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/allowJs/subfolder/index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
==== tests/cases/conformance/node/allowJs/subfolder/index.js (2 errors) ====
// cjs format file
const x = await 1;
~~~~~
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
export {x};
for await (const y of []) {}
~~~~~
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
==== tests/cases/conformance/node/allowJs/index.js (2 errors) ====
// esm format file
const x = await 1;
~~~~~
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
export {x};
for await (const y of []) {}
~~~~~
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
==== tests/cases/conformance/node/allowJs/package.json (0 errors) ====
{
"name": "package",
@@ -1,16 +1,16 @@
tests/cases/conformance/node/allowJs/subfolder/index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/allowJs/subfolder/index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/allowJs/subfolder/index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/allowJs/subfolder/index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
==== tests/cases/conformance/node/allowJs/subfolder/index.js (2 errors) ====
// cjs format file
const x = await 1;
~~~~~
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
export {x};
for await (const y of []) {}
~~~~~
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
==== tests/cases/conformance/node/allowJs/index.js (0 errors) ====
// esm format file
const x = await 1;
@@ -1,27 +1,27 @@
tests/cases/conformance/node/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/subfolder/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/subfolder/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/subfolder/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/subfolder/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
==== tests/cases/conformance/node/subfolder/index.ts (2 errors) ====
// cjs format file
const x = await 1;
~~~~~
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
export {x};
for await (const y of []) {}
~~~~~
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
==== tests/cases/conformance/node/index.ts (2 errors) ====
// esm format file
const x = await 1;
~~~~~
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
export {x};
for await (const y of []) {}
~~~~~
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
==== tests/cases/conformance/node/package.json (0 errors) ====
{
"name": "package",
@@ -1,16 +1,16 @@
tests/cases/conformance/node/subfolder/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/subfolder/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/subfolder/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/node/subfolder/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
==== tests/cases/conformance/node/subfolder/index.ts (2 errors) ====
// cjs format file
const x = await 1;
~~~~~
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
export {x};
for await (const y of []) {}
~~~~~
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
==== tests/cases/conformance/node/index.ts (0 errors) ====
// esm format file
const x = await 1;
@@ -8,10 +8,10 @@ tests/cases/conformance/parser/ecmascript2018/forAwait/inFunctionDeclWithExprIsE
tests/cases/conformance/parser/ecmascript2018/forAwait/inGeneratorWithDeclIsError.ts(3,9): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
tests/cases/conformance/parser/ecmascript2018/forAwait/inGeneratorWithExprIsError.ts(3,9): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithDeclIsError.ts(1,5): error TS1431: 'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module.
tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithDeclIsError.ts(1,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithDeclIsError.ts(1,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithDeclIsError.ts(1,23): error TS2304: Cannot find name 'y'.
tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.ts(1,5): error TS1431: 'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module.
tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.ts(1,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.ts(1,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.ts(1,12): error TS2304: Cannot find name 'x'.
tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.ts(1,17): error TS2304: Cannot find name 'y'.
@@ -21,7 +21,7 @@ tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.t
~~~~~
!!! error TS1431: 'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module.
~~~~~
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
~
!!! error TS2304: Cannot find name 'y'.
}
@@ -30,7 +30,7 @@ tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.t
~~~~~
!!! error TS1431: 'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module.
~~~~~
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
~
!!! error TS2304: Cannot find name 'x'.
~
@@ -0,0 +1,90 @@
tests/cases/conformance/externalModules/index.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/externalModules/index.ts(46,3): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
==== tests/cases/conformance/externalModules/index.ts (2 errors) ====
export const x = 1;
await x;
~~~~~
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
// reparse element access as await
await [x];
await [x, x];
// reparse call as await
declare function f(): number;
await (x);
await (f(), x);
await <number>(x);
await <number>(f(), x);
// reparse tagged template as await
await ``;
await <string> ``;
// member names should be ok
class C1 {
await() {}
}
class C2 {
get await() { return 1; }
set await(value) { }
}
class C3 {
await = 1;
}
({
await() {}
});
({
get await() { return 1 },
set await(value) { }
});
({
await: 1
});
// property access name should be ok
C1.prototype.await;
// await in decorators
declare const dec: any;
@(await dec)
~~~~~
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
class C {
}
// await allowed in aliased import
import { await as _await } from "./other";
// newlines
// await in throw
throw await
1;
// await in var
let y = await
1;
// await in expression statement;
await
1;
==== tests/cases/conformance/externalModules/other.ts (1 errors) ====
const _await = 1;
// await allowed in aliased export
export { _await as await };
// for-await-of
const arr = [Promise.resolve()];
for await (const item of arr) {
~~~~~
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
item;
}
@@ -0,0 +1,152 @@
//// [tests/cases/conformance/externalModules/topLevelAwait.1.ts] ////
//// [index.ts]
export const x = 1;
await x;
// reparse element access as await
await [x];
await [x, x];
// reparse call as await
declare function f(): number;
await (x);
await (f(), x);
await <number>(x);
await <number>(f(), x);
// reparse tagged template as await
await ``;
await <string> ``;
// member names should be ok
class C1 {
await() {}
}
class C2 {
get await() { return 1; }
set await(value) { }
}
class C3 {
await = 1;
}
({
await() {}
});
({
get await() { return 1 },
set await(value) { }
});
({
await: 1
});
// property access name should be ok
C1.prototype.await;
// await in decorators
declare const dec: any;
@(await dec)
class C {
}
// await allowed in aliased import
import { await as _await } from "./other";
// newlines
// await in throw
throw await
1;
// await in var
let y = await
1;
// await in expression statement;
await
1;
//// [other.ts]
const _await = 1;
// await allowed in aliased export
export { _await as await };
// for-await-of
const arr = [Promise.resolve()];
for await (const item of arr) {
item;
}
//// [other.js]
var e_1, _a;
const _await = 1;
// await allowed in aliased export
export { _await as await };
// for-await-of
const arr = [Promise.resolve()];
try {
for (var arr_1 = __asyncValues(arr), arr_1_1; arr_1_1 = await arr_1.next(), !arr_1_1.done;) {
const item = arr_1_1.value;
item;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (arr_1_1 && !arr_1_1.done && (_a = arr_1.return)) await _a.call(arr_1);
}
finally { if (e_1) throw e_1.error; }
}
//// [index.js]
export const x = 1;
await x;
// reparse element access as await
await [x];
await [x, x];
await (x);
await (f(), x);
await (x);
await (f(), x);
// reparse tagged template as await
await ``;
await ``;
// member names should be ok
class C1 {
await() { }
}
class C2 {
get await() { return 1; }
set await(value) { }
}
class C3 {
constructor() {
this.await = 1;
}
}
({
await() { }
});
({
get await() { return 1; },
set await(value) { }
});
({
await: 1
});
// property access name should be ok
C1.prototype.await;
let C = class C {
};
C = __decorate([
(await dec)
], C);
// newlines
// await in throw
throw await 1;
// await in var
let y = await 1;
// await in expression statement;
await 1;
@@ -0,0 +1,143 @@
=== tests/cases/conformance/externalModules/index.ts ===
export const x = 1;
>x : Symbol(x, Decl(index.ts, 0, 12))
await x;
>x : Symbol(x, Decl(index.ts, 0, 12))
// reparse element access as await
await [x];
>x : Symbol(x, Decl(index.ts, 0, 12))
await [x, x];
>x : Symbol(x, Decl(index.ts, 0, 12))
>x : Symbol(x, Decl(index.ts, 0, 12))
// reparse call as await
declare function f(): number;
>f : Symbol(f, Decl(index.ts, 5, 13))
await (x);
>x : Symbol(x, Decl(index.ts, 0, 12))
await (f(), x);
>f : Symbol(f, Decl(index.ts, 5, 13))
>x : Symbol(x, Decl(index.ts, 0, 12))
await <number>(x);
>x : Symbol(x, Decl(index.ts, 0, 12))
await <number>(f(), x);
>f : Symbol(f, Decl(index.ts, 5, 13))
>x : Symbol(x, Decl(index.ts, 0, 12))
// reparse tagged template as await
await ``;
await <string> ``;
// member names should be ok
class C1 {
>C1 : Symbol(C1, Decl(index.ts, 16, 18))
await() {}
>await : Symbol(C1.await, Decl(index.ts, 19, 10))
}
class C2 {
>C2 : Symbol(C2, Decl(index.ts, 21, 1))
get await() { return 1; }
>await : Symbol(C2.await, Decl(index.ts, 22, 10), Decl(index.ts, 23, 29))
set await(value) { }
>await : Symbol(C2.await, Decl(index.ts, 22, 10), Decl(index.ts, 23, 29))
>value : Symbol(value, Decl(index.ts, 24, 14))
}
class C3 {
>C3 : Symbol(C3, Decl(index.ts, 25, 1))
await = 1;
>await : Symbol(C3.await, Decl(index.ts, 26, 10))
}
({
await() {}
>await : Symbol(await, Decl(index.ts, 29, 2))
});
({
get await() { return 1 },
>await : Symbol(await, Decl(index.ts, 32, 2), Decl(index.ts, 33, 29))
set await(value) { }
>await : Symbol(await, Decl(index.ts, 32, 2), Decl(index.ts, 33, 29))
>value : Symbol(value, Decl(index.ts, 34, 14))
});
({
await: 1
>await : Symbol(await, Decl(index.ts, 36, 2))
});
// property access name should be ok
C1.prototype.await;
>C1.prototype.await : Symbol(C1.await, Decl(index.ts, 19, 10))
>C1.prototype : Symbol(C1.prototype)
>C1 : Symbol(C1, Decl(index.ts, 16, 18))
>prototype : Symbol(C1.prototype)
>await : Symbol(C1.await, Decl(index.ts, 19, 10))
// await in decorators
declare const dec: any;
>dec : Symbol(dec, Decl(index.ts, 44, 13))
@(await dec)
>dec : Symbol(dec, Decl(index.ts, 44, 13))
class C {
>C : Symbol(C, Decl(index.ts, 44, 23))
}
// await allowed in aliased import
import { await as _await } from "./other";
>await : Symbol(await, Decl(other.ts, 3, 8))
>_await : Symbol(_await, Decl(index.ts, 50, 8))
// newlines
// await in throw
throw await
1;
// await in var
let y = await
>y : Symbol(y, Decl(index.ts, 58, 3))
1;
// await in expression statement;
await
1;
=== tests/cases/conformance/externalModules/other.ts ===
const _await = 1;
>_await : Symbol(_await, Decl(other.ts, 0, 5))
// await allowed in aliased export
export { _await as await };
>_await : Symbol(_await, Decl(other.ts, 0, 5))
>await : Symbol(await, Decl(other.ts, 3, 8))
// for-await-of
const arr = [Promise.resolve()];
>arr : Symbol(arr, Decl(other.ts, 6, 5))
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
for await (const item of arr) {
>item : Symbol(item, Decl(other.ts, 8, 16))
>arr : Symbol(arr, Decl(other.ts, 6, 5))
item;
>item : Symbol(item, Decl(other.ts, 8, 16))
}
@@ -0,0 +1,195 @@
=== tests/cases/conformance/externalModules/index.ts ===
export const x = 1;
>x : 1
>1 : 1
await x;
>await x : 1
>x : 1
// reparse element access as await
await [x];
>await [x] : number[]
>[x] : number[]
>x : 1
await [x, x];
>await [x, x] : number[]
>[x, x] : number[]
>x : 1
>x : 1
// reparse call as await
declare function f(): number;
>f : () => number
await (x);
>await (x) : 1
>(x) : 1
>x : 1
await (f(), x);
>await (f(), x) : 1
>(f(), x) : 1
>f(), x : 1
>f() : number
>f : () => number
>x : 1
await <number>(x);
>await <number>(x) : number
><number>(x) : number
>(x) : 1
>x : 1
await <number>(f(), x);
>await <number>(f(), x) : number
><number>(f(), x) : number
>(f(), x) : 1
>f(), x : 1
>f() : number
>f : () => number
>x : 1
// reparse tagged template as await
await ``;
>await `` : ""
>`` : ""
await <string> ``;
>await <string> `` : string
><string> `` : string
>`` : ""
// member names should be ok
class C1 {
>C1 : C1
await() {}
>await : () => void
}
class C2 {
>C2 : C2
get await() { return 1; }
>await : number
>1 : 1
set await(value) { }
>await : number
>value : number
}
class C3 {
>C3 : C3
await = 1;
>await : number
>1 : 1
}
({
>({ await() {}}) : { await(): void; }
>{ await() {}} : { await(): void; }
await() {}
>await : () => void
});
({
>({ get await() { return 1 }, set await(value) { }}) : { await: number; }
>{ get await() { return 1 }, set await(value) { }} : { await: number; }
get await() { return 1 },
>await : number
>1 : 1
set await(value) { }
>await : number
>value : number
});
({
>({ await: 1}) : { await: number; }
>{ await: 1} : { await: number; }
await: 1
>await : number
>1 : 1
});
// property access name should be ok
C1.prototype.await;
>C1.prototype.await : () => void
>C1.prototype : C1
>C1 : typeof C1
>prototype : C1
>await : () => void
// await in decorators
declare const dec: any;
>dec : any
@(await dec)
>(await dec) : any
>await dec : any
>dec : any
class C {
>C : C
}
// await allowed in aliased import
import { await as _await } from "./other";
>await : 1
>_await : 1
// newlines
// await in throw
throw await
>await 1 : 1
1;
>1 : 1
// await in var
let y = await
>y : number
>await 1 : 1
1;
>1 : 1
// await in expression statement;
await
>await 1 : 1
1;
>1 : 1
=== tests/cases/conformance/externalModules/other.ts ===
const _await = 1;
>_await : 1
>1 : 1
// await allowed in aliased export
export { _await as await };
>_await : 1
>await : 1
// for-await-of
const arr = [Promise.resolve()];
>arr : Promise<void>[]
>[Promise.resolve()] : Promise<void>[]
>Promise.resolve() : Promise<void>
>Promise.resolve : { (): Promise<void>; <T>(value: T | PromiseLike<T>): Promise<T>; }
>Promise : PromiseConstructor
>resolve : { (): Promise<void>; <T>(value: T | PromiseLike<T>): Promise<T>; }
for await (const item of arr) {
>item : void
>arr : Promise<void>[]
item;
>item : void
}
@@ -0,0 +1,152 @@
//// [tests/cases/conformance/externalModules/topLevelAwait.1.ts] ////
//// [index.ts]
export const x = 1;
await x;
// reparse element access as await
await [x];
await [x, x];
// reparse call as await
declare function f(): number;
await (x);
await (f(), x);
await <number>(x);
await <number>(f(), x);
// reparse tagged template as await
await ``;
await <string> ``;
// member names should be ok
class C1 {
await() {}
}
class C2 {
get await() { return 1; }
set await(value) { }
}
class C3 {
await = 1;
}
({
await() {}
});
({
get await() { return 1 },
set await(value) { }
});
({
await: 1
});
// property access name should be ok
C1.prototype.await;
// await in decorators
declare const dec: any;
@(await dec)
class C {
}
// await allowed in aliased import
import { await as _await } from "./other";
// newlines
// await in throw
throw await
1;
// await in var
let y = await
1;
// await in expression statement;
await
1;
//// [other.ts]
const _await = 1;
// await allowed in aliased export
export { _await as await };
// for-await-of
const arr = [Promise.resolve()];
for await (const item of arr) {
item;
}
//// [other.js]
var e_1, _a;
const _await = 1;
// await allowed in aliased export
export { _await as await };
// for-await-of
const arr = [Promise.resolve()];
try {
for (var arr_1 = __asyncValues(arr), arr_1_1; arr_1_1 = await arr_1.next(), !arr_1_1.done;) {
const item = arr_1_1.value;
item;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (arr_1_1 && !arr_1_1.done && (_a = arr_1.return)) await _a.call(arr_1);
}
finally { if (e_1) throw e_1.error; }
}
//// [index.js]
export const x = 1;
await x;
// reparse element access as await
await [x];
await [x, x];
await (x);
await (f(), x);
await (x);
await (f(), x);
// reparse tagged template as await
await ``;
await ``;
// member names should be ok
class C1 {
await() { }
}
class C2 {
get await() { return 1; }
set await(value) { }
}
class C3 {
constructor() {
this.await = 1;
}
}
({
await() { }
});
({
get await() { return 1; },
set await(value) { }
});
({
await: 1
});
// property access name should be ok
C1.prototype.await;
let C = class C {
};
C = __decorate([
(await dec)
], C);
// newlines
// await in throw
throw await 1;
// await in var
let y = await 1;
// await in expression statement;
await 1;
@@ -0,0 +1,143 @@
=== tests/cases/conformance/externalModules/index.ts ===
export const x = 1;
>x : Symbol(x, Decl(index.ts, 0, 12))
await x;
>x : Symbol(x, Decl(index.ts, 0, 12))
// reparse element access as await
await [x];
>x : Symbol(x, Decl(index.ts, 0, 12))
await [x, x];
>x : Symbol(x, Decl(index.ts, 0, 12))
>x : Symbol(x, Decl(index.ts, 0, 12))
// reparse call as await
declare function f(): number;
>f : Symbol(f, Decl(index.ts, 5, 13))
await (x);
>x : Symbol(x, Decl(index.ts, 0, 12))
await (f(), x);
>f : Symbol(f, Decl(index.ts, 5, 13))
>x : Symbol(x, Decl(index.ts, 0, 12))
await <number>(x);
>x : Symbol(x, Decl(index.ts, 0, 12))
await <number>(f(), x);
>f : Symbol(f, Decl(index.ts, 5, 13))
>x : Symbol(x, Decl(index.ts, 0, 12))
// reparse tagged template as await
await ``;
await <string> ``;
// member names should be ok
class C1 {
>C1 : Symbol(C1, Decl(index.ts, 16, 18))
await() {}
>await : Symbol(C1.await, Decl(index.ts, 19, 10))
}
class C2 {
>C2 : Symbol(C2, Decl(index.ts, 21, 1))
get await() { return 1; }
>await : Symbol(C2.await, Decl(index.ts, 22, 10), Decl(index.ts, 23, 29))
set await(value) { }
>await : Symbol(C2.await, Decl(index.ts, 22, 10), Decl(index.ts, 23, 29))
>value : Symbol(value, Decl(index.ts, 24, 14))
}
class C3 {
>C3 : Symbol(C3, Decl(index.ts, 25, 1))
await = 1;
>await : Symbol(C3.await, Decl(index.ts, 26, 10))
}
({
await() {}
>await : Symbol(await, Decl(index.ts, 29, 2))
});
({
get await() { return 1 },
>await : Symbol(await, Decl(index.ts, 32, 2), Decl(index.ts, 33, 29))
set await(value) { }
>await : Symbol(await, Decl(index.ts, 32, 2), Decl(index.ts, 33, 29))
>value : Symbol(value, Decl(index.ts, 34, 14))
});
({
await: 1
>await : Symbol(await, Decl(index.ts, 36, 2))
});
// property access name should be ok
C1.prototype.await;
>C1.prototype.await : Symbol(C1.await, Decl(index.ts, 19, 10))
>C1.prototype : Symbol(C1.prototype)
>C1 : Symbol(C1, Decl(index.ts, 16, 18))
>prototype : Symbol(C1.prototype)
>await : Symbol(C1.await, Decl(index.ts, 19, 10))
// await in decorators
declare const dec: any;
>dec : Symbol(dec, Decl(index.ts, 44, 13))
@(await dec)
>dec : Symbol(dec, Decl(index.ts, 44, 13))
class C {
>C : Symbol(C, Decl(index.ts, 44, 23))
}
// await allowed in aliased import
import { await as _await } from "./other";
>await : Symbol(await, Decl(other.ts, 3, 8))
>_await : Symbol(_await, Decl(index.ts, 50, 8))
// newlines
// await in throw
throw await
1;
// await in var
let y = await
>y : Symbol(y, Decl(index.ts, 58, 3))
1;
// await in expression statement;
await
1;
=== tests/cases/conformance/externalModules/other.ts ===
const _await = 1;
>_await : Symbol(_await, Decl(other.ts, 0, 5))
// await allowed in aliased export
export { _await as await };
>_await : Symbol(_await, Decl(other.ts, 0, 5))
>await : Symbol(await, Decl(other.ts, 3, 8))
// for-await-of
const arr = [Promise.resolve()];
>arr : Symbol(arr, Decl(other.ts, 6, 5))
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
for await (const item of arr) {
>item : Symbol(item, Decl(other.ts, 8, 16))
>arr : Symbol(arr, Decl(other.ts, 6, 5))
item;
>item : Symbol(item, Decl(other.ts, 8, 16))
}
@@ -0,0 +1,195 @@
=== tests/cases/conformance/externalModules/index.ts ===
export const x = 1;
>x : 1
>1 : 1
await x;
>await x : 1
>x : 1
// reparse element access as await
await [x];
>await [x] : number[]
>[x] : number[]
>x : 1
await [x, x];
>await [x, x] : number[]
>[x, x] : number[]
>x : 1
>x : 1
// reparse call as await
declare function f(): number;
>f : () => number
await (x);
>await (x) : 1
>(x) : 1
>x : 1
await (f(), x);
>await (f(), x) : 1
>(f(), x) : 1
>f(), x : 1
>f() : number
>f : () => number
>x : 1
await <number>(x);
>await <number>(x) : number
><number>(x) : number
>(x) : 1
>x : 1
await <number>(f(), x);
>await <number>(f(), x) : number
><number>(f(), x) : number
>(f(), x) : 1
>f(), x : 1
>f() : number
>f : () => number
>x : 1
// reparse tagged template as await
await ``;
>await `` : ""
>`` : ""
await <string> ``;
>await <string> `` : string
><string> `` : string
>`` : ""
// member names should be ok
class C1 {
>C1 : C1
await() {}
>await : () => void
}
class C2 {
>C2 : C2
get await() { return 1; }
>await : number
>1 : 1
set await(value) { }
>await : number
>value : number
}
class C3 {
>C3 : C3
await = 1;
>await : number
>1 : 1
}
({
>({ await() {}}) : { await(): void; }
>{ await() {}} : { await(): void; }
await() {}
>await : () => void
});
({
>({ get await() { return 1 }, set await(value) { }}) : { await: number; }
>{ get await() { return 1 }, set await(value) { }} : { await: number; }
get await() { return 1 },
>await : number
>1 : 1
set await(value) { }
>await : number
>value : number
});
({
>({ await: 1}) : { await: number; }
>{ await: 1} : { await: number; }
await: 1
>await : number
>1 : 1
});
// property access name should be ok
C1.prototype.await;
>C1.prototype.await : () => void
>C1.prototype : C1
>C1 : typeof C1
>prototype : C1
>await : () => void
// await in decorators
declare const dec: any;
>dec : any
@(await dec)
>(await dec) : any
>await dec : any
>dec : any
class C {
>C : C
}
// await allowed in aliased import
import { await as _await } from "./other";
>await : 1
>_await : 1
// newlines
// await in throw
throw await
>await 1 : 1
1;
>1 : 1
// await in var
let y = await
>y : number
>await 1 : 1
1;
>1 : 1
// await in expression statement;
await
>await 1 : 1
1;
>1 : 1
=== tests/cases/conformance/externalModules/other.ts ===
const _await = 1;
>_await : 1
>1 : 1
// await allowed in aliased export
export { _await as await };
>_await : 1
>await : 1
// for-await-of
const arr = [Promise.resolve()];
>arr : Promise<void>[]
>[Promise.resolve()] : Promise<void>[]
>Promise.resolve() : Promise<void>
>Promise.resolve : { (): Promise<void>; <T>(value: T | PromiseLike<T>): Promise<T>; }
>Promise : PromiseConstructor
>resolve : { (): Promise<void>; <T>(value: T | PromiseLike<T>): Promise<T>; }
for await (const item of arr) {
>item : void
>arr : Promise<void>[]
item;
>item : void
}
@@ -1,13 +1,13 @@
tests/cases/conformance/externalModules/index.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/externalModules/index.ts(46,3): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/externalModules/index.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/externalModules/index.ts(46,3): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
==== tests/cases/conformance/externalModules/index.ts (2 errors) ====
export const x = 1;
await x;
~~~~~
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
// reparse element access as await
await [x];
@@ -53,7 +53,7 @@ tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level '
declare const dec: any;
@(await dec)
~~~~~
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
class C {
}
@@ -84,7 +84,7 @@ tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level '
for await (const item of arr) {
~~~~~
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
item;
}
@@ -1,13 +1,13 @@
tests/cases/conformance/externalModules/index.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/externalModules/index.ts(46,3): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/externalModules/index.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/externalModules/index.ts(46,3): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
==== tests/cases/conformance/externalModules/index.ts (2 errors) ====
export const x = 1;
await x;
~~~~~
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
// reparse element access as await
await [x];
@@ -53,7 +53,7 @@ tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level '
declare const dec: any;
@(await dec)
~~~~~
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
class C {
}
@@ -84,7 +84,7 @@ tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level '
for await (const item of arr) {
~~~~~
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
item;
}
@@ -0,0 +1,10 @@
//// [topLevelAwait.2.ts]
declare namespace foo { const await: any; }
// await allowed in import=namespace when not a module
import await = foo.await;
//// [topLevelAwait.2.js]
// await allowed in import=namespace when not a module
var await = foo.await;
@@ -0,0 +1,11 @@
=== tests/cases/conformance/externalModules/topLevelAwait.2.ts ===
declare namespace foo { const await: any; }
>foo : Symbol(foo, Decl(topLevelAwait.2.ts, 0, 0))
>await : Symbol(await, Decl(topLevelAwait.2.ts, 0, 29))
// await allowed in import=namespace when not a module
import await = foo.await;
>await : Symbol(await, Decl(topLevelAwait.2.ts, 0, 43))
>foo : Symbol(foo, Decl(topLevelAwait.2.ts, 0, 0))
>await : Symbol(await, Decl(topLevelAwait.2.ts, 0, 29))
@@ -0,0 +1,11 @@
=== tests/cases/conformance/externalModules/topLevelAwait.2.ts ===
declare namespace foo { const await: any; }
>foo : typeof foo
>await : any
// await allowed in import=namespace when not a module
import await = foo.await;
>await : any
>foo : typeof foo
>await : any
@@ -0,0 +1,10 @@
=== tests/cases/conformance/externalModules/index.d.ts ===
// await keyword allowed as identifier in a declaration file
export {};
declare const await: any;
>await : Symbol(await, Decl(index.d.ts, 2, 13))
declare class C extends await {}
>C : Symbol(C, Decl(index.d.ts, 2, 25))
>await : Symbol(await, Decl(index.d.ts, 2, 13))
@@ -0,0 +1,10 @@
=== tests/cases/conformance/externalModules/index.d.ts ===
// await keyword allowed as identifier in a declaration file
export {};
declare const await: any;
>await : any
declare class C extends await {}
>C : C
>await : any
@@ -0,0 +1,107 @@
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(4,8): error TS2695: Left side of comma operator is unused and has no side effects.
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(4,10): error TS1109: Expression expected.
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(5,14): error TS1005: '>' expected.
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(5,16): error TS2693: 'string' only refers to a type, but is being used as a value here.
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(8,14): error TS1005: '>' expected.
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(8,16): error TS2693: 'string' only refers to a type, but is being used as a value here.
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(11,17): error TS1109: Expression expected.
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(11,22): error TS1109: Expression expected.
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(11,23): error TS2693: 'string' only refers to a type, but is being used as a value here.
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(11,29): error TS1005: ',' expected.
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(15,8): error TS1109: Expression expected.
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(18,2): error TS1109: Expression expected.
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(18,8): error TS2304: Cannot find name 'x'.
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(21,2): error TS1109: Expression expected.
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(26,6): error TS1109: Expression expected.
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(30,6): error TS1109: Expression expected.
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(34,12): error TS1109: Expression expected.
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(40,14): error TS1109: Expression expected.
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(41,14): error TS1109: Expression expected.
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(42,20): error TS1109: Expression expected.
==== tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts (20 errors) ====
export {};
// reparse call as invalid await should error
await (1,);
~
!!! error TS2695: Left side of comma operator is unused and has no side effects.
~
!!! error TS1109: Expression expected.
await <number, string>(1);
~
!!! error TS1005: '>' expected.
~~~~~~
!!! error TS2693: 'string' only refers to a type, but is being used as a value here.
// reparse tagged template as invalid await should error
await <number, string> ``;
~
!!! error TS1005: '>' expected.
~~~~~~
!!! error TS2693: 'string' only refers to a type, but is being used as a value here.
// reparse class extends clause should fail
class C extends await<string> {
~~~~~
!!! error TS1109: Expression expected.
~
!!! error TS1109: Expression expected.
~~~~~~
!!! error TS2693: 'string' only refers to a type, but is being used as a value here.
~
!!! error TS1005: ',' expected.
}
// await in class decorators should fail
@(await)
~
!!! error TS1109: Expression expected.
class C1 {}
@await(x)
~~~~~
!!! error TS1109: Expression expected.
~
!!! error TS2304: Cannot find name 'x'.
class C2 {}
@await
~~~~~
!!! error TS1109: Expression expected.
class C3 {}
// await in member decorators should fail
class C4 {
@await
~~~~~
!!! error TS1109: Expression expected.
["foo"]() {}
}
class C5 {
@await(1)
~~~~~
!!! error TS1109: Expression expected.
["foo"]() {}
}
class C6 {
@(await)
~
!!! error TS1109: Expression expected.
["foo"]() {}
}
// await in parameter decorators should fail
class C7 {
method1(@await [x]) {}
~~~~~
!!! error TS1109: Expression expected.
method2(@await(1) [x]) {}
~~~~~
!!! error TS1109: Expression expected.
method3(@(await) [x]) {}
~
!!! error TS1109: Expression expected.
}
@@ -0,0 +1,104 @@
//// [topLevelAwaitErrors.1.ts]
export {};
// reparse call as invalid await should error
await (1,);
await <number, string>(1);
// reparse tagged template as invalid await should error
await <number, string> ``;
// reparse class extends clause should fail
class C extends await<string> {
}
// await in class decorators should fail
@(await)
class C1 {}
@await(x)
class C2 {}
@await
class C3 {}
// await in member decorators should fail
class C4 {
@await
["foo"]() {}
}
class C5 {
@await(1)
["foo"]() {}
}
class C6 {
@(await)
["foo"]() {}
}
// await in parameter decorators should fail
class C7 {
method1(@await [x]) {}
method2(@await(1) [x]) {}
method3(@(await) [x]) {}
}
//// [topLevelAwaitErrors.1.js]
// reparse call as invalid await should error
await (1, );
await , string > (1);
// reparse tagged template as invalid await should error
await , string > ``;
// reparse class extends clause should fail
class C extends string {
}
// await in class decorators should fail
let C1 = class C1 {
};
C1 = __decorate([
(await )
], C1);
let C2 = class C2 {
};
C2 = __decorate([
(x)
], C2);
let C3 = class C3 {
};
C3 = __decorate([
], C3);
// await in member decorators should fail
class C4 {
["foo"]() { }
}
__decorate([
], C4.prototype, "foo", null);
class C5 {
["foo"]() { }
}
__decorate([
(1)
], C5.prototype, "foo", null);
class C6 {
["foo"]() { }
}
__decorate([
(await )
], C6.prototype, "foo", null);
// await in parameter decorators should fail
class C7 {
method1([x]) { }
method2([x]) { }
method3([x]) { }
}
__decorate([
__param(0, )
], C7.prototype, "method1", null);
__decorate([
__param(0, (1))
], C7.prototype, "method2", null);
__decorate([
__param(0, (await ))
], C7.prototype, "method3", null);
export {};
@@ -0,0 +1,71 @@
=== tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts ===
export {};
// reparse call as invalid await should error
await (1,);
await <number, string>(1);
// reparse tagged template as invalid await should error
await <number, string> ``;
// reparse class extends clause should fail
class C extends await<string> {
>C : Symbol(C, Decl(topLevelAwaitErrors.1.ts, 7, 26))
}
// await in class decorators should fail
@(await)
class C1 {}
>C1 : Symbol(C1, Decl(topLevelAwaitErrors.1.ts, 11, 1))
@await(x)
class C2 {}
>C2 : Symbol(C2, Decl(topLevelAwaitErrors.1.ts, 15, 11))
@await
class C3 {}
>C3 : Symbol(C3, Decl(topLevelAwaitErrors.1.ts, 18, 11))
// await in member decorators should fail
class C4 {
>C4 : Symbol(C4, Decl(topLevelAwaitErrors.1.ts, 21, 11))
@await
["foo"]() {}
>["foo"] : Symbol(C4["foo"], Decl(topLevelAwaitErrors.1.ts, 24, 10))
>"foo" : Symbol(C4["foo"], Decl(topLevelAwaitErrors.1.ts, 24, 10))
}
class C5 {
>C5 : Symbol(C5, Decl(topLevelAwaitErrors.1.ts, 27, 1))
@await(1)
["foo"]() {}
>["foo"] : Symbol(C5["foo"], Decl(topLevelAwaitErrors.1.ts, 28, 10))
>"foo" : Symbol(C5["foo"], Decl(topLevelAwaitErrors.1.ts, 28, 10))
}
class C6 {
>C6 : Symbol(C6, Decl(topLevelAwaitErrors.1.ts, 31, 1))
@(await)
["foo"]() {}
>["foo"] : Symbol(C6["foo"], Decl(topLevelAwaitErrors.1.ts, 32, 10))
>"foo" : Symbol(C6["foo"], Decl(topLevelAwaitErrors.1.ts, 32, 10))
}
// await in parameter decorators should fail
class C7 {
>C7 : Symbol(C7, Decl(topLevelAwaitErrors.1.ts, 35, 1))
method1(@await [x]) {}
>method1 : Symbol(C7.method1, Decl(topLevelAwaitErrors.1.ts, 38, 10))
>x : Symbol(x, Decl(topLevelAwaitErrors.1.ts, 39, 20))
method2(@await(1) [x]) {}
>method2 : Symbol(C7.method2, Decl(topLevelAwaitErrors.1.ts, 39, 26))
>x : Symbol(x, Decl(topLevelAwaitErrors.1.ts, 40, 23))
method3(@(await) [x]) {}
>method3 : Symbol(C7.method3, Decl(topLevelAwaitErrors.1.ts, 40, 29))
>x : Symbol(x, Decl(topLevelAwaitErrors.1.ts, 41, 22))
}
@@ -0,0 +1,120 @@
=== tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts ===
export {};
// reparse call as invalid await should error
await (1,);
>await (1,) : any
>(1,) : any
>1, : any
>1 : 1
> : any
await <number, string>(1);
>await <number, string>(1) : boolean
>await <number : number
><number : number
> : any
>string>(1) : boolean
>string : any
>(1) : 1
>1 : 1
// reparse tagged template as invalid await should error
await <number, string> ``;
>await <number, string> `` : boolean
>await <number : number
><number : number
> : any
>string> `` : boolean
>string : any
>`` : ""
// reparse class extends clause should fail
class C extends await<string> {
>C : C
>string : any
}
// await in class decorators should fail
@(await)
>(await) : any
>await : any
> : any
class C1 {}
>C1 : C1
@await(x)
>await(x) : any
> : any
>x : any
class C2 {}
>C2 : C2
@await
> : any
class C3 {}
>C3 : C3
// await in member decorators should fail
class C4 {
>C4 : C4
@await
> : any
["foo"]() {}
>["foo"] : () => void
>"foo" : "foo"
}
class C5 {
>C5 : C5
@await(1)
>await(1) : any
> : any
>1 : 1
["foo"]() {}
>["foo"] : () => void
>"foo" : "foo"
}
class C6 {
>C6 : C6
@(await)
>(await) : any
>await : any
> : any
["foo"]() {}
>["foo"] : () => void
>"foo" : "foo"
}
// await in parameter decorators should fail
class C7 {
>C7 : C7
method1(@await [x]) {}
>method1 : ([x]: [any]) => void
> : any
>x : any
method2(@await(1) [x]) {}
>method2 : ([x]: [any]) => void
>await(1) : any
> : any
>1 : 1
>x : any
method3(@(await) [x]) {}
>method3 : ([x]: [any]) => void
>(await) : any
>await : any
> : any
>x : any
}
@@ -0,0 +1,13 @@
tests/cases/conformance/externalModules/index.ts(2,19): error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
==== tests/cases/conformance/externalModules/index.ts (1 errors) ====
// await disallowed in alias of named import
import { await as await } from "./other";
~~~~~
!!! error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
==== tests/cases/conformance/externalModules/other.ts (0 errors) ====
declare const _await: any;
export { _await as await };
@@ -0,0 +1,15 @@
//// [tests/cases/conformance/externalModules/topLevelAwaitErrors.10.ts] ////
//// [index.ts]
// await disallowed in alias of named import
import { await as await } from "./other";
//// [other.ts]
declare const _await: any;
export { _await as await };
//// [other.js]
export { _await as await };
//// [index.js]
export {};
@@ -0,0 +1,14 @@
=== tests/cases/conformance/externalModules/index.ts ===
// await disallowed in alias of named import
import { await as await } from "./other";
>await : Symbol(await, Decl(other.ts, 1, 8))
>await : Symbol(await, Decl(index.ts, 1, 8))
=== tests/cases/conformance/externalModules/other.ts ===
declare const _await: any;
>_await : Symbol(_await, Decl(other.ts, 0, 13))
export { _await as await };
>_await : Symbol(_await, Decl(other.ts, 0, 13))
>await : Symbol(await, Decl(other.ts, 1, 8))
@@ -0,0 +1,14 @@
=== tests/cases/conformance/externalModules/index.ts ===
// await disallowed in alias of named import
import { await as await } from "./other";
>await : any
>await : any
=== tests/cases/conformance/externalModules/other.ts ===
declare const _await: any;
>_await : any
export { _await as await };
>_await : any
>await : any
@@ -0,0 +1,12 @@
tests/cases/conformance/externalModules/topLevelAwaitErrors.12.ts(5,8): error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
==== tests/cases/conformance/externalModules/topLevelAwaitErrors.12.ts (1 errors) ====
export {};
declare namespace foo { const await: any; }
// await disallowed in import=namespace when in a module
import await = foo.await;
~~~~~
!!! error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
@@ -0,0 +1,10 @@
//// [topLevelAwaitErrors.12.ts]
export {};
declare namespace foo { const await: any; }
// await disallowed in import=namespace when in a module
import await = foo.await;
//// [topLevelAwaitErrors.12.js]
export {};
@@ -0,0 +1,12 @@
=== tests/cases/conformance/externalModules/topLevelAwaitErrors.12.ts ===
export {};
declare namespace foo { const await: any; }
>foo : Symbol(foo, Decl(topLevelAwaitErrors.12.ts, 0, 10))
>await : Symbol(await, Decl(topLevelAwaitErrors.12.ts, 1, 29))
// await disallowed in import=namespace when in a module
import await = foo.await;
>await : Symbol(await, Decl(topLevelAwaitErrors.12.ts, 1, 43))
>foo : Symbol(foo, Decl(topLevelAwaitErrors.12.ts, 0, 10))
>await : Symbol(await, Decl(topLevelAwaitErrors.12.ts, 1, 29))
@@ -0,0 +1,12 @@
=== tests/cases/conformance/externalModules/topLevelAwaitErrors.12.ts ===
export {};
declare namespace foo { const await: any; }
>foo : typeof foo
>await : any
// await disallowed in import=namespace when in a module
import await = foo.await;
>await : any
>foo : typeof foo
>await : any
@@ -0,0 +1,11 @@
tests/cases/conformance/externalModules/topLevelAwaitErrors.2.ts(4,5): error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
==== tests/cases/conformance/externalModules/topLevelAwaitErrors.2.ts (1 errors) ====
export {};
// reparse variable name as await should fail
var await = 1;
~~~~~
!!! error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
@@ -0,0 +1,11 @@
//// [topLevelAwaitErrors.2.ts]
export {};
// reparse variable name as await should fail
var await = 1;
//// [topLevelAwaitErrors.2.js]
// reparse variable name as await should fail
var await = 1;
export {};
@@ -0,0 +1,7 @@
=== tests/cases/conformance/externalModules/topLevelAwaitErrors.2.ts ===
export {};
// reparse variable name as await should fail
var await = 1;
>await : Symbol(await, Decl(topLevelAwaitErrors.2.ts, 3, 3))
@@ -0,0 +1,8 @@
=== tests/cases/conformance/externalModules/topLevelAwaitErrors.2.ts ===
export {};
// reparse variable name as await should fail
var await = 1;
>await : number
>1 : 1
@@ -0,0 +1,11 @@
tests/cases/conformance/externalModules/topLevelAwaitErrors.3.ts(4,6): error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
==== tests/cases/conformance/externalModules/topLevelAwaitErrors.3.ts (1 errors) ====
export {};
// reparse binding pattern as await should fail
var {await} = {await:1};
~~~~~
!!! error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
@@ -0,0 +1,11 @@
//// [topLevelAwaitErrors.3.ts]
export {};
// reparse binding pattern as await should fail
var {await} = {await:1};
//// [topLevelAwaitErrors.3.js]
// reparse binding pattern as await should fail
var { await } = { await: 1 };
export {};
@@ -0,0 +1,8 @@
=== tests/cases/conformance/externalModules/topLevelAwaitErrors.3.ts ===
export {};
// reparse binding pattern as await should fail
var {await} = {await:1};
>await : Symbol(await, Decl(topLevelAwaitErrors.3.ts, 3, 5))
>await : Symbol(await, Decl(topLevelAwaitErrors.3.ts, 3, 15))
@@ -0,0 +1,10 @@
=== tests/cases/conformance/externalModules/topLevelAwaitErrors.3.ts ===
export {};
// reparse binding pattern as await should fail
var {await} = {await:1};
>await : number
>{await:1} : { await: number; }
>await : number
>1 : 1
@@ -0,0 +1,11 @@
tests/cases/conformance/externalModules/topLevelAwaitErrors.4.ts(4,6): error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
==== tests/cases/conformance/externalModules/topLevelAwaitErrors.4.ts (1 errors) ====
export {};
// reparse binding pattern as await should fail
var [await] = [1];
~~~~~
!!! error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
@@ -0,0 +1,11 @@
//// [topLevelAwaitErrors.4.ts]
export {};
// reparse binding pattern as await should fail
var [await] = [1];
//// [topLevelAwaitErrors.4.js]
// reparse binding pattern as await should fail
var [await] = [1];
export {};
@@ -0,0 +1,7 @@
=== tests/cases/conformance/externalModules/topLevelAwaitErrors.4.ts ===
export {};
// reparse binding pattern as await should fail
var [await] = [1];
>await : Symbol(await, Decl(topLevelAwaitErrors.4.ts, 3, 5))
@@ -0,0 +1,9 @@
=== tests/cases/conformance/externalModules/topLevelAwaitErrors.4.ts ===
export {};
// reparse binding pattern as await should fail
var [await] = [1];
>await : number
>[1] : [number]
>1 : 1
@@ -0,0 +1,10 @@
tests/cases/conformance/externalModules/topLevelAwaitErrors.5.ts(2,14): error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
==== tests/cases/conformance/externalModules/topLevelAwaitErrors.5.ts (1 errors) ====
// await in exported class name should fail
export class await {
~~~~~
!!! error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
}
@@ -0,0 +1,10 @@
//// [topLevelAwaitErrors.5.ts]
// await in exported class name should fail
export class await {
}
//// [topLevelAwaitErrors.5.js]
// await in exported class name should fail
export class await {
}
@@ -0,0 +1,6 @@
=== tests/cases/conformance/externalModules/topLevelAwaitErrors.5.ts ===
// await in exported class name should fail
export class await {
>await : Symbol(await, Decl(topLevelAwaitErrors.5.ts, 0, 0))
}

Some files were not shown because too many files have changed in this diff Show More