From d4655b1062392fd71f39cfb3ee47b1b4a8e13995 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Fri, 18 Jun 2021 19:51:35 +0200 Subject: [PATCH] Add `module: es2022` Closes #44653 --- src/compiler/checker.ts | 24 +-- src/compiler/commandLineParser.ts | 1 + src/compiler/diagnosticMessages.json | 8 +- src/compiler/transformer.ts | 1 + src/compiler/transformers/ts.ts | 1 + src/compiler/types.ts | 1 + src/compiler/utilities.ts | 1 + .../codefixes/fixModuleAndTargetOptions.ts | 4 +- src/services/codefixes/importFixes.ts | 1 + .../unittests/config/commandLineParsing.ts | 2 +- .../config/convertCompilerOptionsFromJson.ts | 2 +- .../reference/api/tsserverlibrary.d.ts | 1 + tests/baselines/reference/api/typescript.d.ts | 1 + .../awaitInNonAsyncFunction.errors.txt | 8 +- ...lpersWithLocalCollisions(module=es2022).js | 24 +++ ...importAssertion1(module=es2015).errors.txt | 36 ++-- ...portCallExpressionErrorInES2015.errors.txt | 12 +- ...mportCallExpressionNestedES2015.errors.txt | 8 +- ...portCallExpressionNestedES20152.errors.txt | 8 +- ...eta(module=commonjs,target=es5).errors.txt | 52 ++--- ...(module=commonjs,target=esnext).errors.txt | 52 ++--- ...wJsTopLevelAwait(module=node12).errors.txt | 16 +- ...sTopLevelAwait(module=nodenext).errors.txt | 8 +- ...lesTopLevelAwait(module=node12).errors.txt | 16 +- ...sTopLevelAwait(module=nodenext).errors.txt | 8 +- .../parser.forAwait.es2018.errors.txt | 8 +- ....1(module=es2022,target=es2015).errors.txt | 90 ++++++++ ...velAwait.1(module=es2022,target=es2015).js | 152 ++++++++++++++ ...ait.1(module=es2022,target=es2015).symbols | 143 +++++++++++++ ...Await.1(module=es2022,target=es2015).types | 195 ++++++++++++++++++ ...velAwait.1(module=es2022,target=es2017).js | 152 ++++++++++++++ ...ait.1(module=es2022,target=es2017).symbols | 143 +++++++++++++ ...Await.1(module=es2022,target=es2017).types | 195 ++++++++++++++++++ ....1(module=esnext,target=es2015).errors.txt | 12 +- ....1(module=system,target=es2015).errors.txt | 12 +- ...2.js => topLevelAwait.2(module=es2022).js} | 0 ...=> topLevelAwait.2(module=es2022).symbols} | 0 ...s => topLevelAwait.2(module=es2022).types} | 0 .../topLevelAwait.2(module=esnext).js | 10 + .../topLevelAwait.2(module=esnext).symbols | 11 + .../topLevelAwait.2(module=esnext).types | 11 + ...=> topLevelAwait.3(module=es2022).symbols} | 0 ...s => topLevelAwait.3(module=es2022).types} | 0 .../topLevelAwait.3(module=esnext).symbols | 10 + .../topLevelAwait.3(module=esnext).types | 10 + ...elAwaitErrors.1(module=es2022).errors.txt} | 0 ...> topLevelAwaitErrors.1(module=es2022).js} | 0 ...LevelAwaitErrors.1(module=es2022).symbols} | 0 ...opLevelAwaitErrors.1(module=es2022).types} | 0 ...velAwaitErrors.1(module=esnext).errors.txt | 107 ++++++++++ .../topLevelAwaitErrors.1(module=esnext).js | 104 ++++++++++ ...pLevelAwaitErrors.1(module=esnext).symbols | 71 +++++++ ...topLevelAwaitErrors.1(module=esnext).types | 120 +++++++++++ ...lAwaitErrors.10(module=es2022).errors.txt} | 0 ... topLevelAwaitErrors.10(module=es2022).js} | 0 ...evelAwaitErrors.10(module=es2022).symbols} | 0 ...pLevelAwaitErrors.10(module=es2022).types} | 0 ...elAwaitErrors.10(module=esnext).errors.txt | 13 ++ .../topLevelAwaitErrors.10(module=esnext).js | 15 ++ ...LevelAwaitErrors.10(module=esnext).symbols | 14 ++ ...opLevelAwaitErrors.10(module=esnext).types | 14 ++ ...lAwaitErrors.12(module=es2022).errors.txt} | 0 ... topLevelAwaitErrors.12(module=es2022).js} | 0 ...evelAwaitErrors.12(module=es2022).symbols} | 0 ...pLevelAwaitErrors.12(module=es2022).types} | 0 ...elAwaitErrors.12(module=esnext).errors.txt | 12 ++ .../topLevelAwaitErrors.12(module=esnext).js | 10 + ...LevelAwaitErrors.12(module=esnext).symbols | 12 ++ ...opLevelAwaitErrors.12(module=esnext).types | 12 ++ ...elAwaitErrors.2(module=es2022).errors.txt} | 0 ...> topLevelAwaitErrors.2(module=es2022).js} | 0 ...LevelAwaitErrors.2(module=es2022).symbols} | 0 ...opLevelAwaitErrors.2(module=es2022).types} | 0 ...velAwaitErrors.2(module=esnext).errors.txt | 11 + .../topLevelAwaitErrors.2(module=esnext).js | 11 + ...pLevelAwaitErrors.2(module=esnext).symbols | 7 + ...topLevelAwaitErrors.2(module=esnext).types | 8 + ...elAwaitErrors.3(module=es2022).errors.txt} | 0 ...> topLevelAwaitErrors.3(module=es2022).js} | 0 ...LevelAwaitErrors.3(module=es2022).symbols} | 0 ...opLevelAwaitErrors.3(module=es2022).types} | 0 ...velAwaitErrors.3(module=esnext).errors.txt | 11 + .../topLevelAwaitErrors.3(module=esnext).js | 11 + ...pLevelAwaitErrors.3(module=esnext).symbols | 8 + ...topLevelAwaitErrors.3(module=esnext).types | 10 + ...elAwaitErrors.4(module=es2022).errors.txt} | 0 ...> topLevelAwaitErrors.4(module=es2022).js} | 0 ...LevelAwaitErrors.4(module=es2022).symbols} | 0 ...opLevelAwaitErrors.4(module=es2022).types} | 0 ...velAwaitErrors.4(module=esnext).errors.txt | 11 + .../topLevelAwaitErrors.4(module=esnext).js | 11 + ...pLevelAwaitErrors.4(module=esnext).symbols | 7 + ...topLevelAwaitErrors.4(module=esnext).types | 9 + ...elAwaitErrors.5(module=es2022).errors.txt} | 0 ...> topLevelAwaitErrors.5(module=es2022).js} | 0 ...LevelAwaitErrors.5(module=es2022).symbols} | 0 ...opLevelAwaitErrors.5(module=es2022).types} | 0 ...velAwaitErrors.5(module=esnext).errors.txt | 10 + .../topLevelAwaitErrors.5(module=esnext).js | 10 + ...pLevelAwaitErrors.5(module=esnext).symbols | 6 + ...topLevelAwaitErrors.5(module=esnext).types | 6 + ...elAwaitErrors.6(module=es2022).errors.txt} | 0 ...> topLevelAwaitErrors.6(module=es2022).js} | 0 ...LevelAwaitErrors.6(module=es2022).symbols} | 0 ...opLevelAwaitErrors.6(module=es2022).types} | 0 ...velAwaitErrors.6(module=esnext).errors.txt | 10 + .../topLevelAwaitErrors.6(module=esnext).js | 10 + ...pLevelAwaitErrors.6(module=esnext).symbols | 6 + ...topLevelAwaitErrors.6(module=esnext).types | 6 + ...elAwaitErrors.7(module=es2022).errors.txt} | 3 +- ...> topLevelAwaitErrors.7(module=es2022).js} | 3 +- ...LevelAwaitErrors.7(module=es2022).symbols} | 0 ...opLevelAwaitErrors.7(module=es2022).types} | 0 ...velAwaitErrors.7(module=esnext).errors.txt | 13 ++ .../topLevelAwaitErrors.7(module=esnext).js | 15 ++ ...pLevelAwaitErrors.7(module=esnext).symbols | 13 ++ ...topLevelAwaitErrors.7(module=esnext).types | 13 ++ ...elAwaitErrors.8(module=es2022).errors.txt} | 0 ...> topLevelAwaitErrors.8(module=es2022).js} | 0 ...LevelAwaitErrors.8(module=es2022).symbols} | 0 ...opLevelAwaitErrors.8(module=es2022).types} | 0 ...velAwaitErrors.8(module=esnext).errors.txt | 13 ++ .../topLevelAwaitErrors.8(module=esnext).js | 15 ++ ...pLevelAwaitErrors.8(module=esnext).symbols | 12 ++ ...topLevelAwaitErrors.8(module=esnext).types | 12 ++ ...elAwaitErrors.9(module=es2022).errors.txt} | 0 ...> topLevelAwaitErrors.9(module=es2022).js} | 0 ...LevelAwaitErrors.9(module=es2022).symbols} | 0 ...opLevelAwaitErrors.9(module=es2022).types} | 0 ...velAwaitErrors.9(module=esnext).errors.txt | 13 ++ .../topLevelAwaitErrors.9(module=esnext).js | 15 ++ ...pLevelAwaitErrors.9(module=esnext).symbols | 13 ++ ...topLevelAwaitErrors.9(module=esnext).types | 13 ++ ...lAwaitNonModule(module=es2022).errors.txt} | 0 ... topLevelAwaitNonModule(module=es2022).js} | 0 ...evelAwaitNonModule(module=es2022).symbols} | 0 ...pLevelAwaitNonModule(module=es2022).types} | 0 ...elAwaitNonModule(module=esnext).errors.txt | 20 ++ .../topLevelAwaitNonModule(module=esnext).js | 16 ++ ...LevelAwaitNonModule(module=esnext).symbols | 17 ++ ...opLevelAwaitNonModule(module=esnext).types | 21 ++ ...ons module-kind is out-of-range.errors.txt | 4 +- ...nd is out-of-range.oldTranspile.errors.txt | 4 +- ...s target-script is out-of-range.errors.txt | 4 +- ...pt is out-of-range.oldTranspile.errors.txt | 4 +- ...does-not-add-color-when-NO_COLOR-is-set.js | 2 +- ...-when-host-can't-provide-terminal-width.js | 2 +- ...tatus.DiagnosticsPresent_OutputsSkipped.js | 2 +- .../externalModules/topLevelAwait.1.ts | 2 +- .../externalModules/topLevelAwait.2.ts | 2 +- .../externalModules/topLevelAwait.3.ts | 4 +- .../externalModules/topLevelAwaitErrors.1.ts | 2 +- .../externalModules/topLevelAwaitErrors.10.ts | 2 +- .../externalModules/topLevelAwaitErrors.12.ts | 2 +- .../externalModules/topLevelAwaitErrors.2.ts | 2 +- .../externalModules/topLevelAwaitErrors.3.ts | 2 +- .../externalModules/topLevelAwaitErrors.4.ts | 2 +- .../externalModules/topLevelAwaitErrors.5.ts | 2 +- .../externalModules/topLevelAwaitErrors.6.ts | 2 +- .../externalModules/topLevelAwaitErrors.7.ts | 4 +- .../externalModules/topLevelAwaitErrors.8.ts | 2 +- .../externalModules/topLevelAwaitErrors.9.ts | 2 +- .../externalModules/topLevelAwaitNonModule.ts | 2 +- 163 files changed, 2250 insertions(+), 179 deletions(-) create mode 100644 tests/baselines/reference/emitHelpersWithLocalCollisions(module=es2022).js create mode 100644 tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).errors.txt create mode 100644 tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).js create mode 100644 tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).symbols create mode 100644 tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).types create mode 100644 tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2017).js create mode 100644 tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2017).symbols create mode 100644 tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2017).types rename tests/baselines/reference/{topLevelAwait.2.js => topLevelAwait.2(module=es2022).js} (100%) rename tests/baselines/reference/{topLevelAwait.2.symbols => topLevelAwait.2(module=es2022).symbols} (100%) rename tests/baselines/reference/{topLevelAwait.2.types => topLevelAwait.2(module=es2022).types} (100%) create mode 100644 tests/baselines/reference/topLevelAwait.2(module=esnext).js create mode 100644 tests/baselines/reference/topLevelAwait.2(module=esnext).symbols create mode 100644 tests/baselines/reference/topLevelAwait.2(module=esnext).types rename tests/baselines/reference/{topLevelAwait.3.symbols => topLevelAwait.3(module=es2022).symbols} (100%) rename tests/baselines/reference/{topLevelAwait.3.types => topLevelAwait.3(module=es2022).types} (100%) create mode 100644 tests/baselines/reference/topLevelAwait.3(module=esnext).symbols create mode 100644 tests/baselines/reference/topLevelAwait.3(module=esnext).types rename tests/baselines/reference/{topLevelAwaitErrors.1.errors.txt => topLevelAwaitErrors.1(module=es2022).errors.txt} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.1.js => topLevelAwaitErrors.1(module=es2022).js} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.1.symbols => topLevelAwaitErrors.1(module=es2022).symbols} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.1.types => topLevelAwaitErrors.1(module=es2022).types} (100%) create mode 100644 tests/baselines/reference/topLevelAwaitErrors.1(module=esnext).errors.txt create mode 100644 tests/baselines/reference/topLevelAwaitErrors.1(module=esnext).js create mode 100644 tests/baselines/reference/topLevelAwaitErrors.1(module=esnext).symbols create mode 100644 tests/baselines/reference/topLevelAwaitErrors.1(module=esnext).types rename tests/baselines/reference/{topLevelAwaitErrors.10.errors.txt => topLevelAwaitErrors.10(module=es2022).errors.txt} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.10.js => topLevelAwaitErrors.10(module=es2022).js} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.10.symbols => topLevelAwaitErrors.10(module=es2022).symbols} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.10.types => topLevelAwaitErrors.10(module=es2022).types} (100%) create mode 100644 tests/baselines/reference/topLevelAwaitErrors.10(module=esnext).errors.txt create mode 100644 tests/baselines/reference/topLevelAwaitErrors.10(module=esnext).js create mode 100644 tests/baselines/reference/topLevelAwaitErrors.10(module=esnext).symbols create mode 100644 tests/baselines/reference/topLevelAwaitErrors.10(module=esnext).types rename tests/baselines/reference/{topLevelAwaitErrors.12.errors.txt => topLevelAwaitErrors.12(module=es2022).errors.txt} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.12.js => topLevelAwaitErrors.12(module=es2022).js} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.12.symbols => topLevelAwaitErrors.12(module=es2022).symbols} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.12.types => topLevelAwaitErrors.12(module=es2022).types} (100%) create mode 100644 tests/baselines/reference/topLevelAwaitErrors.12(module=esnext).errors.txt create mode 100644 tests/baselines/reference/topLevelAwaitErrors.12(module=esnext).js create mode 100644 tests/baselines/reference/topLevelAwaitErrors.12(module=esnext).symbols create mode 100644 tests/baselines/reference/topLevelAwaitErrors.12(module=esnext).types rename tests/baselines/reference/{topLevelAwaitErrors.2.errors.txt => topLevelAwaitErrors.2(module=es2022).errors.txt} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.2.js => topLevelAwaitErrors.2(module=es2022).js} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.2.symbols => topLevelAwaitErrors.2(module=es2022).symbols} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.2.types => topLevelAwaitErrors.2(module=es2022).types} (100%) create mode 100644 tests/baselines/reference/topLevelAwaitErrors.2(module=esnext).errors.txt create mode 100644 tests/baselines/reference/topLevelAwaitErrors.2(module=esnext).js create mode 100644 tests/baselines/reference/topLevelAwaitErrors.2(module=esnext).symbols create mode 100644 tests/baselines/reference/topLevelAwaitErrors.2(module=esnext).types rename tests/baselines/reference/{topLevelAwaitErrors.3.errors.txt => topLevelAwaitErrors.3(module=es2022).errors.txt} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.3.js => topLevelAwaitErrors.3(module=es2022).js} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.3.symbols => topLevelAwaitErrors.3(module=es2022).symbols} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.3.types => topLevelAwaitErrors.3(module=es2022).types} (100%) create mode 100644 tests/baselines/reference/topLevelAwaitErrors.3(module=esnext).errors.txt create mode 100644 tests/baselines/reference/topLevelAwaitErrors.3(module=esnext).js create mode 100644 tests/baselines/reference/topLevelAwaitErrors.3(module=esnext).symbols create mode 100644 tests/baselines/reference/topLevelAwaitErrors.3(module=esnext).types rename tests/baselines/reference/{topLevelAwaitErrors.4.errors.txt => topLevelAwaitErrors.4(module=es2022).errors.txt} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.4.js => topLevelAwaitErrors.4(module=es2022).js} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.4.symbols => topLevelAwaitErrors.4(module=es2022).symbols} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.4.types => topLevelAwaitErrors.4(module=es2022).types} (100%) create mode 100644 tests/baselines/reference/topLevelAwaitErrors.4(module=esnext).errors.txt create mode 100644 tests/baselines/reference/topLevelAwaitErrors.4(module=esnext).js create mode 100644 tests/baselines/reference/topLevelAwaitErrors.4(module=esnext).symbols create mode 100644 tests/baselines/reference/topLevelAwaitErrors.4(module=esnext).types rename tests/baselines/reference/{topLevelAwaitErrors.5.errors.txt => topLevelAwaitErrors.5(module=es2022).errors.txt} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.5.js => topLevelAwaitErrors.5(module=es2022).js} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.5.symbols => topLevelAwaitErrors.5(module=es2022).symbols} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.5.types => topLevelAwaitErrors.5(module=es2022).types} (100%) create mode 100644 tests/baselines/reference/topLevelAwaitErrors.5(module=esnext).errors.txt create mode 100644 tests/baselines/reference/topLevelAwaitErrors.5(module=esnext).js create mode 100644 tests/baselines/reference/topLevelAwaitErrors.5(module=esnext).symbols create mode 100644 tests/baselines/reference/topLevelAwaitErrors.5(module=esnext).types rename tests/baselines/reference/{topLevelAwaitErrors.6.errors.txt => topLevelAwaitErrors.6(module=es2022).errors.txt} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.6.js => topLevelAwaitErrors.6(module=es2022).js} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.6.symbols => topLevelAwaitErrors.6(module=es2022).symbols} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.6.types => topLevelAwaitErrors.6(module=es2022).types} (100%) create mode 100644 tests/baselines/reference/topLevelAwaitErrors.6(module=esnext).errors.txt create mode 100644 tests/baselines/reference/topLevelAwaitErrors.6(module=esnext).js create mode 100644 tests/baselines/reference/topLevelAwaitErrors.6(module=esnext).symbols create mode 100644 tests/baselines/reference/topLevelAwaitErrors.6(module=esnext).types rename tests/baselines/reference/{topLevelAwaitErrors.7.errors.txt => topLevelAwaitErrors.7(module=es2022).errors.txt} (91%) rename tests/baselines/reference/{topLevelAwaitErrors.7.js => topLevelAwaitErrors.7(module=es2022).js} (96%) rename tests/baselines/reference/{topLevelAwaitErrors.7.symbols => topLevelAwaitErrors.7(module=es2022).symbols} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.7.types => topLevelAwaitErrors.7(module=es2022).types} (100%) create mode 100644 tests/baselines/reference/topLevelAwaitErrors.7(module=esnext).errors.txt create mode 100644 tests/baselines/reference/topLevelAwaitErrors.7(module=esnext).js create mode 100644 tests/baselines/reference/topLevelAwaitErrors.7(module=esnext).symbols create mode 100644 tests/baselines/reference/topLevelAwaitErrors.7(module=esnext).types rename tests/baselines/reference/{topLevelAwaitErrors.8.errors.txt => topLevelAwaitErrors.8(module=es2022).errors.txt} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.8.js => topLevelAwaitErrors.8(module=es2022).js} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.8.symbols => topLevelAwaitErrors.8(module=es2022).symbols} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.8.types => topLevelAwaitErrors.8(module=es2022).types} (100%) create mode 100644 tests/baselines/reference/topLevelAwaitErrors.8(module=esnext).errors.txt create mode 100644 tests/baselines/reference/topLevelAwaitErrors.8(module=esnext).js create mode 100644 tests/baselines/reference/topLevelAwaitErrors.8(module=esnext).symbols create mode 100644 tests/baselines/reference/topLevelAwaitErrors.8(module=esnext).types rename tests/baselines/reference/{topLevelAwaitErrors.9.errors.txt => topLevelAwaitErrors.9(module=es2022).errors.txt} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.9.js => topLevelAwaitErrors.9(module=es2022).js} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.9.symbols => topLevelAwaitErrors.9(module=es2022).symbols} (100%) rename tests/baselines/reference/{topLevelAwaitErrors.9.types => topLevelAwaitErrors.9(module=es2022).types} (100%) create mode 100644 tests/baselines/reference/topLevelAwaitErrors.9(module=esnext).errors.txt create mode 100644 tests/baselines/reference/topLevelAwaitErrors.9(module=esnext).js create mode 100644 tests/baselines/reference/topLevelAwaitErrors.9(module=esnext).symbols create mode 100644 tests/baselines/reference/topLevelAwaitErrors.9(module=esnext).types rename tests/baselines/reference/{topLevelAwaitNonModule.errors.txt => topLevelAwaitNonModule(module=es2022).errors.txt} (100%) rename tests/baselines/reference/{topLevelAwaitNonModule.js => topLevelAwaitNonModule(module=es2022).js} (100%) rename tests/baselines/reference/{topLevelAwaitNonModule.symbols => topLevelAwaitNonModule(module=es2022).symbols} (100%) rename tests/baselines/reference/{topLevelAwaitNonModule.types => topLevelAwaitNonModule(module=es2022).types} (100%) create mode 100644 tests/baselines/reference/topLevelAwaitNonModule(module=esnext).errors.txt create mode 100644 tests/baselines/reference/topLevelAwaitNonModule(module=esnext).js create mode 100644 tests/baselines/reference/topLevelAwaitNonModule(module=esnext).symbols create mode 100644 tests/baselines/reference/topLevelAwaitNonModule(module=esnext).types diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 20078bc12d87a..023d3f2ce430f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -30987,16 +30987,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; @@ -32018,10 +32016,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); } } @@ -42680,9 +42678,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)); } } } @@ -43431,7 +43429,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) { diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 118b72e252a94..b94f7531426e7 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -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, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 084295b4ee5b6..219559928e98d 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -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 }, diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index 4c4b07d23a43a..12aeca7f67d5c 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -3,6 +3,7 @@ namespace ts { function getModuleTransformer(moduleKind: ModuleKind): TransformerFactory { switch (moduleKind) { case ModuleKind.ESNext: + case ModuleKind.ES2022: case ModuleKind.ES2020: case ModuleKind.ES2015: return transformECMAScriptModule; diff --git a/src/compiler/transformers/ts.ts b/src/compiler/transformers/ts.ts index 9dae42e335196..2e8c6230a86d2 100644 --- a/src/compiler/transformers/ts.ts +++ b/src/compiler/transformers/ts.ts @@ -2507,6 +2507,7 @@ namespace ts { || (isExternalModuleExport(node) && moduleKind !== ModuleKind.ES2015 && moduleKind !== ModuleKind.ES2020 + && moduleKind !== ModuleKind.ES2022 && moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.System); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index c3bb8de6344c7..1ddf4082880f5 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -6189,6 +6189,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 diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index f433cff16cd2e..2bf2a3a5392dc 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -6166,6 +6166,7 @@ namespace ts { case ModuleKind.AMD: case ModuleKind.ES2015: case ModuleKind.ES2020: + case ModuleKind.ES2022: case ModuleKind.ESNext: return true; default: diff --git a/src/services/codefixes/fixModuleAndTargetOptions.ts b/src/services/codefixes/fixModuleAndTargetOptions.ts index 45e1185cac909..93659c72be742 100644 --- a/src/services/codefixes/fixModuleAndTargetOptions.ts +++ b/src/services/codefixes/fixModuleAndTargetOptions.ts @@ -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(); diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 3fc29c64b9935..ba4f22a694f96 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -593,6 +593,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. diff --git a/src/testRunner/unittests/config/commandLineParsing.ts b/src/testRunner/unittests/config/commandLineParsing.ts index 50bb22cdfbc8e..3891229b6498e 100644 --- a/src/testRunner/unittests/config/commandLineParsing.ts +++ b/src/testRunner/unittests/config/commandLineParsing.ts @@ -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, diff --git a/src/testRunner/unittests/config/convertCompilerOptionsFromJson.ts b/src/testRunner/unittests/config/convertCompilerOptionsFromJson.ts index f388f7e2b5d99..96da312068abd 100644 --- a/src/testRunner/unittests/config/convertCompilerOptionsFromJson.ts +++ b/src/testRunner/unittests/config/convertCompilerOptionsFromJson.ts @@ -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 }] diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 05c90b4600ce8..50a19b16b202b 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -3023,6 +3023,7 @@ declare namespace ts { System = 4, ES2015 = 5, ES2020 = 6, + ES2022 = 7, ESNext = 99, Node12 = 100, NodeNext = 199 diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 6dc1325f9139e..e90d7bc69db94 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3023,6 +3023,7 @@ declare namespace ts { System = 4, ES2015 = 5, ES2020 = 6, + ES2022 = 7, ESNext = 99, Node12 = 100, NodeNext = 199 diff --git a/tests/baselines/reference/awaitInNonAsyncFunction.errors.txt b/tests/baselines/reference/awaitInNonAsyncFunction.errors.txt index 6a5b413c154c2..0c8ac2b8ec9bd 100644 --- a/tests/baselines/reference/awaitInNonAsyncFunction.errors.txt +++ b/tests/baselines/reference/awaitInNonAsyncFunction.errors.txt @@ -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. \ No newline at end of file +!!! 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. \ No newline at end of file diff --git a/tests/baselines/reference/emitHelpersWithLocalCollisions(module=es2022).js b/tests/baselines/reference/emitHelpersWithLocalCollisions(module=es2022).js new file mode 100644 index 0000000000000..74b96c362b390 --- /dev/null +++ b/tests/baselines/reference/emitHelpersWithLocalCollisions(module=es2022).js @@ -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); diff --git a/tests/baselines/reference/importAssertion1(module=es2015).errors.txt b/tests/baselines/reference/importAssertion1(module=es2015).errors.txt index 12775e5e5807b..28290d8f67290 100644 --- a/tests/baselines/reference/importAssertion1(module=es2015).errors.txt +++ b/tests/baselines/reference/importAssertion1(module=es2015).errors.txt @@ -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'. \ No newline at end of file diff --git a/tests/baselines/reference/importCallExpressionErrorInES2015.errors.txt b/tests/baselines/reference/importCallExpressionErrorInES2015.errors.txt index 95937040daa0d..43821679002c4 100644 --- a/tests/baselines/reference/importCallExpressionErrorInES2015.errors.txt +++ b/tests/baselines/reference/importCallExpressionErrorInES2015.errors.txt @@ -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'. } \ No newline at end of file diff --git a/tests/baselines/reference/importCallExpressionNestedES2015.errors.txt b/tests/baselines/reference/importCallExpressionNestedES2015.errors.txt index 4d1f7a55b3ce8..5e37388bc02f4 100644 --- a/tests/baselines/reference/importCallExpressionNestedES2015.errors.txt +++ b/tests/baselines/reference/importCallExpressionNestedES2015.errors.txt @@ -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'. } \ No newline at end of file diff --git a/tests/baselines/reference/importCallExpressionNestedES20152.errors.txt b/tests/baselines/reference/importCallExpressionNestedES20152.errors.txt index 4d1f7a55b3ce8..5e37388bc02f4 100644 --- a/tests/baselines/reference/importCallExpressionNestedES20152.errors.txt +++ b/tests/baselines/reference/importCallExpressionNestedES20152.errors.txt @@ -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'. } \ No newline at end of file diff --git a/tests/baselines/reference/importMeta(module=commonjs,target=es5).errors.txt b/tests/baselines/reference/importMeta(module=commonjs,target=es5).errors.txt index ba01672d75a8f..9c82043ec74d1 100644 --- a/tests/baselines/reference/importMeta(module=commonjs,target=es5).errors.txt +++ b/tests/baselines/reference/importMeta(module=commonjs,target=es5).errors.txt @@ -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'. \ No newline at end of file +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'. \ No newline at end of file diff --git a/tests/baselines/reference/importMeta(module=commonjs,target=esnext).errors.txt b/tests/baselines/reference/importMeta(module=commonjs,target=esnext).errors.txt index ba01672d75a8f..9c82043ec74d1 100644 --- a/tests/baselines/reference/importMeta(module=commonjs,target=esnext).errors.txt +++ b/tests/baselines/reference/importMeta(module=commonjs,target=esnext).errors.txt @@ -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'. \ No newline at end of file +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'. \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node12).errors.txt b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node12).errors.txt index eff86eab7e9d6..b7096bfd56e69 100644 --- a/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node12).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=node12).errors.txt @@ -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", diff --git a/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=nodenext).errors.txt index f2b3347f94df8..50ff19655e97d 100644 --- a/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsTopLevelAwait(module=nodenext).errors.txt @@ -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; diff --git a/tests/baselines/reference/nodeModulesTopLevelAwait(module=node12).errors.txt b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node12).errors.txt index 3a02a6e3d3737..12596b85ab232 100644 --- a/tests/baselines/reference/nodeModulesTopLevelAwait(module=node12).errors.txt +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node12).errors.txt @@ -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", diff --git a/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).errors.txt index a8fa4008492e7..140c9f2c32cde 100644 --- a/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).errors.txt @@ -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; diff --git a/tests/baselines/reference/parser.forAwait.es2018.errors.txt b/tests/baselines/reference/parser.forAwait.es2018.errors.txt index 5969e4b6256b1..1f1f9de097352 100644 --- a/tests/baselines/reference/parser.forAwait.es2018.errors.txt +++ b/tests/baselines/reference/parser.forAwait.es2018.errors.txt @@ -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'. ~ diff --git a/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).errors.txt b/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).errors.txt new file mode 100644 index 0000000000000..1c56871bbd5cb --- /dev/null +++ b/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).errors.txt @@ -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 (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 { + 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; + } + \ No newline at end of file diff --git a/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).js b/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).js new file mode 100644 index 0000000000000..fcba60c9bafac --- /dev/null +++ b/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).js @@ -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 (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 { + 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; diff --git a/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).symbols b/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).symbols new file mode 100644 index 0000000000000..29020fceb3acf --- /dev/null +++ b/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).symbols @@ -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 (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)) + +// reparse tagged template as await +await ``; +await ``; + +// 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)) +} + diff --git a/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).types b/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).types new file mode 100644 index 0000000000000..c3d2a0c0a9bb5 --- /dev/null +++ b/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2015).types @@ -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 (x); +>await (x) : number +>(x) : number +>(x) : 1 +>x : 1 + +await (f(), x); +>await (f(), x) : number +>(f(), x) : number +>(f(), x) : 1 +>f(), x : 1 +>f() : number +>f : () => number +>x : 1 + +// reparse tagged template as await +await ``; +>await `` : "" +>`` : "" + +await ``; +>await `` : 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[] +>[Promise.resolve()] : Promise[] +>Promise.resolve() : Promise +>Promise.resolve : { (): Promise; (value: T | PromiseLike): Promise; } +>Promise : PromiseConstructor +>resolve : { (): Promise; (value: T | PromiseLike): Promise; } + +for await (const item of arr) { +>item : void +>arr : Promise[] + + item; +>item : void +} + diff --git a/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2017).js b/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2017).js new file mode 100644 index 0000000000000..fcba60c9bafac --- /dev/null +++ b/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2017).js @@ -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 (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 { + 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; diff --git a/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2017).symbols b/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2017).symbols new file mode 100644 index 0000000000000..29020fceb3acf --- /dev/null +++ b/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2017).symbols @@ -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 (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)) + +// reparse tagged template as await +await ``; +await ``; + +// 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)) +} + diff --git a/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2017).types b/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2017).types new file mode 100644 index 0000000000000..c3d2a0c0a9bb5 --- /dev/null +++ b/tests/baselines/reference/topLevelAwait.1(module=es2022,target=es2017).types @@ -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 (x); +>await (x) : number +>(x) : number +>(x) : 1 +>x : 1 + +await (f(), x); +>await (f(), x) : number +>(f(), x) : number +>(f(), x) : 1 +>f(), x : 1 +>f() : number +>f : () => number +>x : 1 + +// reparse tagged template as await +await ``; +>await `` : "" +>`` : "" + +await ``; +>await `` : 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[] +>[Promise.resolve()] : Promise[] +>Promise.resolve() : Promise +>Promise.resolve : { (): Promise; (value: T | PromiseLike): Promise; } +>Promise : PromiseConstructor +>resolve : { (): Promise; (value: T | PromiseLike): Promise; } + +for await (const item of arr) { +>item : void +>arr : Promise[] + + item; +>item : void +} + diff --git a/tests/baselines/reference/topLevelAwait.1(module=esnext,target=es2015).errors.txt b/tests/baselines/reference/topLevelAwait.1(module=esnext,target=es2015).errors.txt index 1c4b9b820b7ed..1c56871bbd5cb 100644 --- a/tests/baselines/reference/topLevelAwait.1(module=esnext,target=es2015).errors.txt +++ b/tests/baselines/reference/topLevelAwait.1(module=esnext,target=es2015).errors.txt @@ -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; } \ No newline at end of file diff --git a/tests/baselines/reference/topLevelAwait.1(module=system,target=es2015).errors.txt b/tests/baselines/reference/topLevelAwait.1(module=system,target=es2015).errors.txt index 1c4b9b820b7ed..1c56871bbd5cb 100644 --- a/tests/baselines/reference/topLevelAwait.1(module=system,target=es2015).errors.txt +++ b/tests/baselines/reference/topLevelAwait.1(module=system,target=es2015).errors.txt @@ -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; } \ No newline at end of file diff --git a/tests/baselines/reference/topLevelAwait.2.js b/tests/baselines/reference/topLevelAwait.2(module=es2022).js similarity index 100% rename from tests/baselines/reference/topLevelAwait.2.js rename to tests/baselines/reference/topLevelAwait.2(module=es2022).js diff --git a/tests/baselines/reference/topLevelAwait.2.symbols b/tests/baselines/reference/topLevelAwait.2(module=es2022).symbols similarity index 100% rename from tests/baselines/reference/topLevelAwait.2.symbols rename to tests/baselines/reference/topLevelAwait.2(module=es2022).symbols diff --git a/tests/baselines/reference/topLevelAwait.2.types b/tests/baselines/reference/topLevelAwait.2(module=es2022).types similarity index 100% rename from tests/baselines/reference/topLevelAwait.2.types rename to tests/baselines/reference/topLevelAwait.2(module=es2022).types diff --git a/tests/baselines/reference/topLevelAwait.2(module=esnext).js b/tests/baselines/reference/topLevelAwait.2(module=esnext).js new file mode 100644 index 0000000000000..eba6d89291b69 --- /dev/null +++ b/tests/baselines/reference/topLevelAwait.2(module=esnext).js @@ -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; diff --git a/tests/baselines/reference/topLevelAwait.2(module=esnext).symbols b/tests/baselines/reference/topLevelAwait.2(module=esnext).symbols new file mode 100644 index 0000000000000..81c4bdd060746 --- /dev/null +++ b/tests/baselines/reference/topLevelAwait.2(module=esnext).symbols @@ -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)) + diff --git a/tests/baselines/reference/topLevelAwait.2(module=esnext).types b/tests/baselines/reference/topLevelAwait.2(module=esnext).types new file mode 100644 index 0000000000000..ebab4ee5f8783 --- /dev/null +++ b/tests/baselines/reference/topLevelAwait.2(module=esnext).types @@ -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 + diff --git a/tests/baselines/reference/topLevelAwait.3.symbols b/tests/baselines/reference/topLevelAwait.3(module=es2022).symbols similarity index 100% rename from tests/baselines/reference/topLevelAwait.3.symbols rename to tests/baselines/reference/topLevelAwait.3(module=es2022).symbols diff --git a/tests/baselines/reference/topLevelAwait.3.types b/tests/baselines/reference/topLevelAwait.3(module=es2022).types similarity index 100% rename from tests/baselines/reference/topLevelAwait.3.types rename to tests/baselines/reference/topLevelAwait.3(module=es2022).types diff --git a/tests/baselines/reference/topLevelAwait.3(module=esnext).symbols b/tests/baselines/reference/topLevelAwait.3(module=esnext).symbols new file mode 100644 index 0000000000000..85bc9cb0b6fad --- /dev/null +++ b/tests/baselines/reference/topLevelAwait.3(module=esnext).symbols @@ -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)) + diff --git a/tests/baselines/reference/topLevelAwait.3(module=esnext).types b/tests/baselines/reference/topLevelAwait.3(module=esnext).types new file mode 100644 index 0000000000000..ae181359dc6f6 --- /dev/null +++ b/tests/baselines/reference/topLevelAwait.3(module=esnext).types @@ -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 + diff --git a/tests/baselines/reference/topLevelAwaitErrors.1.errors.txt b/tests/baselines/reference/topLevelAwaitErrors.1(module=es2022).errors.txt similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.1.errors.txt rename to tests/baselines/reference/topLevelAwaitErrors.1(module=es2022).errors.txt diff --git a/tests/baselines/reference/topLevelAwaitErrors.1.js b/tests/baselines/reference/topLevelAwaitErrors.1(module=es2022).js similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.1.js rename to tests/baselines/reference/topLevelAwaitErrors.1(module=es2022).js diff --git a/tests/baselines/reference/topLevelAwaitErrors.1.symbols b/tests/baselines/reference/topLevelAwaitErrors.1(module=es2022).symbols similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.1.symbols rename to tests/baselines/reference/topLevelAwaitErrors.1(module=es2022).symbols diff --git a/tests/baselines/reference/topLevelAwaitErrors.1.types b/tests/baselines/reference/topLevelAwaitErrors.1(module=es2022).types similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.1.types rename to tests/baselines/reference/topLevelAwaitErrors.1(module=es2022).types diff --git a/tests/baselines/reference/topLevelAwaitErrors.1(module=esnext).errors.txt b/tests/baselines/reference/topLevelAwaitErrors.1(module=esnext).errors.txt new file mode 100644 index 0000000000000..773e8446a6fda --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.1(module=esnext).errors.txt @@ -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 (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 ``; + ~ +!!! 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 { + ~~~~~ +!!! 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. + } + \ No newline at end of file diff --git a/tests/baselines/reference/topLevelAwaitErrors.1(module=esnext).js b/tests/baselines/reference/topLevelAwaitErrors.1(module=esnext).js new file mode 100644 index 0000000000000..175321a0513f8 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.1(module=esnext).js @@ -0,0 +1,104 @@ +//// [topLevelAwaitErrors.1.ts] +export {}; + +// reparse call as invalid await should error +await (1,); +await (1); + +// reparse tagged template as invalid await should error +await ``; + +// reparse class extends clause should fail +class C extends await { +} + +// 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 {}; diff --git a/tests/baselines/reference/topLevelAwaitErrors.1(module=esnext).symbols b/tests/baselines/reference/topLevelAwaitErrors.1(module=esnext).symbols new file mode 100644 index 0000000000000..c414127bbe691 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.1(module=esnext).symbols @@ -0,0 +1,71 @@ +=== tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts === +export {}; + +// reparse call as invalid await should error +await (1,); +await (1); + +// reparse tagged template as invalid await should error +await ``; + +// reparse class extends clause should fail +class C extends await { +>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)) +} + diff --git a/tests/baselines/reference/topLevelAwaitErrors.1(module=esnext).types b/tests/baselines/reference/topLevelAwaitErrors.1(module=esnext).types new file mode 100644 index 0000000000000..7e8efc49dce7f --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.1(module=esnext).types @@ -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 (1); +>await (1) : boolean +>await : any +>string>(1) : boolean +>string : any +>(1) : 1 +>1 : 1 + +// reparse tagged template as invalid await should error +await ``; +>await `` : boolean +>await : any +>string> `` : boolean +>string : any +>`` : "" + +// reparse class extends clause should fail +class C extends await { +>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 +} + diff --git a/tests/baselines/reference/topLevelAwaitErrors.10.errors.txt b/tests/baselines/reference/topLevelAwaitErrors.10(module=es2022).errors.txt similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.10.errors.txt rename to tests/baselines/reference/topLevelAwaitErrors.10(module=es2022).errors.txt diff --git a/tests/baselines/reference/topLevelAwaitErrors.10.js b/tests/baselines/reference/topLevelAwaitErrors.10(module=es2022).js similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.10.js rename to tests/baselines/reference/topLevelAwaitErrors.10(module=es2022).js diff --git a/tests/baselines/reference/topLevelAwaitErrors.10.symbols b/tests/baselines/reference/topLevelAwaitErrors.10(module=es2022).symbols similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.10.symbols rename to tests/baselines/reference/topLevelAwaitErrors.10(module=es2022).symbols diff --git a/tests/baselines/reference/topLevelAwaitErrors.10.types b/tests/baselines/reference/topLevelAwaitErrors.10(module=es2022).types similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.10.types rename to tests/baselines/reference/topLevelAwaitErrors.10(module=es2022).types diff --git a/tests/baselines/reference/topLevelAwaitErrors.10(module=esnext).errors.txt b/tests/baselines/reference/topLevelAwaitErrors.10(module=esnext).errors.txt new file mode 100644 index 0000000000000..999ba4ab21efa --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.10(module=esnext).errors.txt @@ -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 }; + \ No newline at end of file diff --git a/tests/baselines/reference/topLevelAwaitErrors.10(module=esnext).js b/tests/baselines/reference/topLevelAwaitErrors.10(module=esnext).js new file mode 100644 index 0000000000000..4d0c107a0e7f9 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.10(module=esnext).js @@ -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 {}; diff --git a/tests/baselines/reference/topLevelAwaitErrors.10(module=esnext).symbols b/tests/baselines/reference/topLevelAwaitErrors.10(module=esnext).symbols new file mode 100644 index 0000000000000..01b637582def1 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.10(module=esnext).symbols @@ -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)) + diff --git a/tests/baselines/reference/topLevelAwaitErrors.10(module=esnext).types b/tests/baselines/reference/topLevelAwaitErrors.10(module=esnext).types new file mode 100644 index 0000000000000..75595969742a3 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.10(module=esnext).types @@ -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 + diff --git a/tests/baselines/reference/topLevelAwaitErrors.12.errors.txt b/tests/baselines/reference/topLevelAwaitErrors.12(module=es2022).errors.txt similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.12.errors.txt rename to tests/baselines/reference/topLevelAwaitErrors.12(module=es2022).errors.txt diff --git a/tests/baselines/reference/topLevelAwaitErrors.12.js b/tests/baselines/reference/topLevelAwaitErrors.12(module=es2022).js similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.12.js rename to tests/baselines/reference/topLevelAwaitErrors.12(module=es2022).js diff --git a/tests/baselines/reference/topLevelAwaitErrors.12.symbols b/tests/baselines/reference/topLevelAwaitErrors.12(module=es2022).symbols similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.12.symbols rename to tests/baselines/reference/topLevelAwaitErrors.12(module=es2022).symbols diff --git a/tests/baselines/reference/topLevelAwaitErrors.12.types b/tests/baselines/reference/topLevelAwaitErrors.12(module=es2022).types similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.12.types rename to tests/baselines/reference/topLevelAwaitErrors.12(module=es2022).types diff --git a/tests/baselines/reference/topLevelAwaitErrors.12(module=esnext).errors.txt b/tests/baselines/reference/topLevelAwaitErrors.12(module=esnext).errors.txt new file mode 100644 index 0000000000000..55b06a8c96d20 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.12(module=esnext).errors.txt @@ -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. + \ No newline at end of file diff --git a/tests/baselines/reference/topLevelAwaitErrors.12(module=esnext).js b/tests/baselines/reference/topLevelAwaitErrors.12(module=esnext).js new file mode 100644 index 0000000000000..6d1e03272a01e --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.12(module=esnext).js @@ -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 {}; diff --git a/tests/baselines/reference/topLevelAwaitErrors.12(module=esnext).symbols b/tests/baselines/reference/topLevelAwaitErrors.12(module=esnext).symbols new file mode 100644 index 0000000000000..c95ce4822ae0c --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.12(module=esnext).symbols @@ -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)) + diff --git a/tests/baselines/reference/topLevelAwaitErrors.12(module=esnext).types b/tests/baselines/reference/topLevelAwaitErrors.12(module=esnext).types new file mode 100644 index 0000000000000..04099d797b24c --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.12(module=esnext).types @@ -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 + diff --git a/tests/baselines/reference/topLevelAwaitErrors.2.errors.txt b/tests/baselines/reference/topLevelAwaitErrors.2(module=es2022).errors.txt similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.2.errors.txt rename to tests/baselines/reference/topLevelAwaitErrors.2(module=es2022).errors.txt diff --git a/tests/baselines/reference/topLevelAwaitErrors.2.js b/tests/baselines/reference/topLevelAwaitErrors.2(module=es2022).js similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.2.js rename to tests/baselines/reference/topLevelAwaitErrors.2(module=es2022).js diff --git a/tests/baselines/reference/topLevelAwaitErrors.2.symbols b/tests/baselines/reference/topLevelAwaitErrors.2(module=es2022).symbols similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.2.symbols rename to tests/baselines/reference/topLevelAwaitErrors.2(module=es2022).symbols diff --git a/tests/baselines/reference/topLevelAwaitErrors.2.types b/tests/baselines/reference/topLevelAwaitErrors.2(module=es2022).types similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.2.types rename to tests/baselines/reference/topLevelAwaitErrors.2(module=es2022).types diff --git a/tests/baselines/reference/topLevelAwaitErrors.2(module=esnext).errors.txt b/tests/baselines/reference/topLevelAwaitErrors.2(module=esnext).errors.txt new file mode 100644 index 0000000000000..c33dcc141f55b --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.2(module=esnext).errors.txt @@ -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. + \ No newline at end of file diff --git a/tests/baselines/reference/topLevelAwaitErrors.2(module=esnext).js b/tests/baselines/reference/topLevelAwaitErrors.2(module=esnext).js new file mode 100644 index 0000000000000..c602a49167faf --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.2(module=esnext).js @@ -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 {}; diff --git a/tests/baselines/reference/topLevelAwaitErrors.2(module=esnext).symbols b/tests/baselines/reference/topLevelAwaitErrors.2(module=esnext).symbols new file mode 100644 index 0000000000000..fe956e02d4116 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.2(module=esnext).symbols @@ -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)) + diff --git a/tests/baselines/reference/topLevelAwaitErrors.2(module=esnext).types b/tests/baselines/reference/topLevelAwaitErrors.2(module=esnext).types new file mode 100644 index 0000000000000..259a942030be5 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.2(module=esnext).types @@ -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 + diff --git a/tests/baselines/reference/topLevelAwaitErrors.3.errors.txt b/tests/baselines/reference/topLevelAwaitErrors.3(module=es2022).errors.txt similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.3.errors.txt rename to tests/baselines/reference/topLevelAwaitErrors.3(module=es2022).errors.txt diff --git a/tests/baselines/reference/topLevelAwaitErrors.3.js b/tests/baselines/reference/topLevelAwaitErrors.3(module=es2022).js similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.3.js rename to tests/baselines/reference/topLevelAwaitErrors.3(module=es2022).js diff --git a/tests/baselines/reference/topLevelAwaitErrors.3.symbols b/tests/baselines/reference/topLevelAwaitErrors.3(module=es2022).symbols similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.3.symbols rename to tests/baselines/reference/topLevelAwaitErrors.3(module=es2022).symbols diff --git a/tests/baselines/reference/topLevelAwaitErrors.3.types b/tests/baselines/reference/topLevelAwaitErrors.3(module=es2022).types similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.3.types rename to tests/baselines/reference/topLevelAwaitErrors.3(module=es2022).types diff --git a/tests/baselines/reference/topLevelAwaitErrors.3(module=esnext).errors.txt b/tests/baselines/reference/topLevelAwaitErrors.3(module=esnext).errors.txt new file mode 100644 index 0000000000000..e8f7a42817a53 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.3(module=esnext).errors.txt @@ -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. + \ No newline at end of file diff --git a/tests/baselines/reference/topLevelAwaitErrors.3(module=esnext).js b/tests/baselines/reference/topLevelAwaitErrors.3(module=esnext).js new file mode 100644 index 0000000000000..9957fa58fc05a --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.3(module=esnext).js @@ -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 {}; diff --git a/tests/baselines/reference/topLevelAwaitErrors.3(module=esnext).symbols b/tests/baselines/reference/topLevelAwaitErrors.3(module=esnext).symbols new file mode 100644 index 0000000000000..0626ef8b64d66 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.3(module=esnext).symbols @@ -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)) + diff --git a/tests/baselines/reference/topLevelAwaitErrors.3(module=esnext).types b/tests/baselines/reference/topLevelAwaitErrors.3(module=esnext).types new file mode 100644 index 0000000000000..4b98e1217127a --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.3(module=esnext).types @@ -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 + diff --git a/tests/baselines/reference/topLevelAwaitErrors.4.errors.txt b/tests/baselines/reference/topLevelAwaitErrors.4(module=es2022).errors.txt similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.4.errors.txt rename to tests/baselines/reference/topLevelAwaitErrors.4(module=es2022).errors.txt diff --git a/tests/baselines/reference/topLevelAwaitErrors.4.js b/tests/baselines/reference/topLevelAwaitErrors.4(module=es2022).js similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.4.js rename to tests/baselines/reference/topLevelAwaitErrors.4(module=es2022).js diff --git a/tests/baselines/reference/topLevelAwaitErrors.4.symbols b/tests/baselines/reference/topLevelAwaitErrors.4(module=es2022).symbols similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.4.symbols rename to tests/baselines/reference/topLevelAwaitErrors.4(module=es2022).symbols diff --git a/tests/baselines/reference/topLevelAwaitErrors.4.types b/tests/baselines/reference/topLevelAwaitErrors.4(module=es2022).types similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.4.types rename to tests/baselines/reference/topLevelAwaitErrors.4(module=es2022).types diff --git a/tests/baselines/reference/topLevelAwaitErrors.4(module=esnext).errors.txt b/tests/baselines/reference/topLevelAwaitErrors.4(module=esnext).errors.txt new file mode 100644 index 0000000000000..845d4385621cd --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.4(module=esnext).errors.txt @@ -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. + \ No newline at end of file diff --git a/tests/baselines/reference/topLevelAwaitErrors.4(module=esnext).js b/tests/baselines/reference/topLevelAwaitErrors.4(module=esnext).js new file mode 100644 index 0000000000000..47bab9d5c1c1c --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.4(module=esnext).js @@ -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 {}; diff --git a/tests/baselines/reference/topLevelAwaitErrors.4(module=esnext).symbols b/tests/baselines/reference/topLevelAwaitErrors.4(module=esnext).symbols new file mode 100644 index 0000000000000..756d0baaf04bc --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.4(module=esnext).symbols @@ -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)) + diff --git a/tests/baselines/reference/topLevelAwaitErrors.4(module=esnext).types b/tests/baselines/reference/topLevelAwaitErrors.4(module=esnext).types new file mode 100644 index 0000000000000..9afcbbb85480d --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.4(module=esnext).types @@ -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 + diff --git a/tests/baselines/reference/topLevelAwaitErrors.5.errors.txt b/tests/baselines/reference/topLevelAwaitErrors.5(module=es2022).errors.txt similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.5.errors.txt rename to tests/baselines/reference/topLevelAwaitErrors.5(module=es2022).errors.txt diff --git a/tests/baselines/reference/topLevelAwaitErrors.5.js b/tests/baselines/reference/topLevelAwaitErrors.5(module=es2022).js similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.5.js rename to tests/baselines/reference/topLevelAwaitErrors.5(module=es2022).js diff --git a/tests/baselines/reference/topLevelAwaitErrors.5.symbols b/tests/baselines/reference/topLevelAwaitErrors.5(module=es2022).symbols similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.5.symbols rename to tests/baselines/reference/topLevelAwaitErrors.5(module=es2022).symbols diff --git a/tests/baselines/reference/topLevelAwaitErrors.5.types b/tests/baselines/reference/topLevelAwaitErrors.5(module=es2022).types similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.5.types rename to tests/baselines/reference/topLevelAwaitErrors.5(module=es2022).types diff --git a/tests/baselines/reference/topLevelAwaitErrors.5(module=esnext).errors.txt b/tests/baselines/reference/topLevelAwaitErrors.5(module=esnext).errors.txt new file mode 100644 index 0000000000000..75554ce21df80 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.5(module=esnext).errors.txt @@ -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. + } + \ No newline at end of file diff --git a/tests/baselines/reference/topLevelAwaitErrors.5(module=esnext).js b/tests/baselines/reference/topLevelAwaitErrors.5(module=esnext).js new file mode 100644 index 0000000000000..702d0a8003131 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.5(module=esnext).js @@ -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 { +} diff --git a/tests/baselines/reference/topLevelAwaitErrors.5(module=esnext).symbols b/tests/baselines/reference/topLevelAwaitErrors.5(module=esnext).symbols new file mode 100644 index 0000000000000..8d8b4669cf812 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.5(module=esnext).symbols @@ -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)) +} + diff --git a/tests/baselines/reference/topLevelAwaitErrors.5(module=esnext).types b/tests/baselines/reference/topLevelAwaitErrors.5(module=esnext).types new file mode 100644 index 0000000000000..d4a5403dadc9c --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.5(module=esnext).types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/externalModules/topLevelAwaitErrors.5.ts === +// await in exported class name should fail +export class await { +>await : await +} + diff --git a/tests/baselines/reference/topLevelAwaitErrors.6.errors.txt b/tests/baselines/reference/topLevelAwaitErrors.6(module=es2022).errors.txt similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.6.errors.txt rename to tests/baselines/reference/topLevelAwaitErrors.6(module=es2022).errors.txt diff --git a/tests/baselines/reference/topLevelAwaitErrors.6.js b/tests/baselines/reference/topLevelAwaitErrors.6(module=es2022).js similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.6.js rename to tests/baselines/reference/topLevelAwaitErrors.6(module=es2022).js diff --git a/tests/baselines/reference/topLevelAwaitErrors.6.symbols b/tests/baselines/reference/topLevelAwaitErrors.6(module=es2022).symbols similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.6.symbols rename to tests/baselines/reference/topLevelAwaitErrors.6(module=es2022).symbols diff --git a/tests/baselines/reference/topLevelAwaitErrors.6.types b/tests/baselines/reference/topLevelAwaitErrors.6(module=es2022).types similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.6.types rename to tests/baselines/reference/topLevelAwaitErrors.6(module=es2022).types diff --git a/tests/baselines/reference/topLevelAwaitErrors.6(module=esnext).errors.txt b/tests/baselines/reference/topLevelAwaitErrors.6(module=esnext).errors.txt new file mode 100644 index 0000000000000..e7d68df46f212 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.6(module=esnext).errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/externalModules/topLevelAwaitErrors.6.ts(2,17): error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module. + + +==== tests/cases/conformance/externalModules/topLevelAwaitErrors.6.ts (1 errors) ==== + // await in exported function name should fail + export function await() { + ~~~~~ +!!! error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module. + } + \ No newline at end of file diff --git a/tests/baselines/reference/topLevelAwaitErrors.6(module=esnext).js b/tests/baselines/reference/topLevelAwaitErrors.6(module=esnext).js new file mode 100644 index 0000000000000..a4391c56b04ac --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.6(module=esnext).js @@ -0,0 +1,10 @@ +//// [topLevelAwaitErrors.6.ts] +// await in exported function name should fail +export function await() { +} + + +//// [topLevelAwaitErrors.6.js] +// await in exported function name should fail +export function await() { +} diff --git a/tests/baselines/reference/topLevelAwaitErrors.6(module=esnext).symbols b/tests/baselines/reference/topLevelAwaitErrors.6(module=esnext).symbols new file mode 100644 index 0000000000000..8acd78377851c --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.6(module=esnext).symbols @@ -0,0 +1,6 @@ +=== tests/cases/conformance/externalModules/topLevelAwaitErrors.6.ts === +// await in exported function name should fail +export function await() { +>await : Symbol(await, Decl(topLevelAwaitErrors.6.ts, 0, 0)) +} + diff --git a/tests/baselines/reference/topLevelAwaitErrors.6(module=esnext).types b/tests/baselines/reference/topLevelAwaitErrors.6(module=esnext).types new file mode 100644 index 0000000000000..52eef99cfa052 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.6(module=esnext).types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/externalModules/topLevelAwaitErrors.6.ts === +// await in exported function name should fail +export function await() { +>await : () => void +} + diff --git a/tests/baselines/reference/topLevelAwaitErrors.7.errors.txt b/tests/baselines/reference/topLevelAwaitErrors.7(module=es2022).errors.txt similarity index 91% rename from tests/baselines/reference/topLevelAwaitErrors.7.errors.txt rename to tests/baselines/reference/topLevelAwaitErrors.7(module=es2022).errors.txt index ae56ff6fcf343..ba075df62226e 100644 --- a/tests/baselines/reference/topLevelAwaitErrors.7.errors.txt +++ b/tests/baselines/reference/topLevelAwaitErrors.7(module=es2022).errors.txt @@ -9,4 +9,5 @@ tests/cases/conformance/externalModules/index.ts(2,13): error TS1262: Identifier ==== tests/cases/conformance/externalModules/other.ts (0 errors) ==== declare const _await: any; - export { _await as await }; \ No newline at end of file + export { _await as await }; + \ No newline at end of file diff --git a/tests/baselines/reference/topLevelAwaitErrors.7.js b/tests/baselines/reference/topLevelAwaitErrors.7(module=es2022).js similarity index 96% rename from tests/baselines/reference/topLevelAwaitErrors.7.js rename to tests/baselines/reference/topLevelAwaitErrors.7(module=es2022).js index 80f4d0d1dc70d..b4b120b96fabc 100644 --- a/tests/baselines/reference/topLevelAwaitErrors.7.js +++ b/tests/baselines/reference/topLevelAwaitErrors.7(module=es2022).js @@ -6,7 +6,8 @@ import * as await from "./other"; //// [other.ts] declare const _await: any; -export { _await as await }; +export { _await as await }; + //// [other.js] export { _await as await }; diff --git a/tests/baselines/reference/topLevelAwaitErrors.7.symbols b/tests/baselines/reference/topLevelAwaitErrors.7(module=es2022).symbols similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.7.symbols rename to tests/baselines/reference/topLevelAwaitErrors.7(module=es2022).symbols diff --git a/tests/baselines/reference/topLevelAwaitErrors.7.types b/tests/baselines/reference/topLevelAwaitErrors.7(module=es2022).types similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.7.types rename to tests/baselines/reference/topLevelAwaitErrors.7(module=es2022).types diff --git a/tests/baselines/reference/topLevelAwaitErrors.7(module=esnext).errors.txt b/tests/baselines/reference/topLevelAwaitErrors.7(module=esnext).errors.txt new file mode 100644 index 0000000000000..ba075df62226e --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.7(module=esnext).errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/externalModules/index.ts(2,13): 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 namespace import + import * 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 }; + \ No newline at end of file diff --git a/tests/baselines/reference/topLevelAwaitErrors.7(module=esnext).js b/tests/baselines/reference/topLevelAwaitErrors.7(module=esnext).js new file mode 100644 index 0000000000000..b4b120b96fabc --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.7(module=esnext).js @@ -0,0 +1,15 @@ +//// [tests/cases/conformance/externalModules/topLevelAwaitErrors.7.ts] //// + +//// [index.ts] +// await disallowed in namespace import +import * as await from "./other"; + +//// [other.ts] +declare const _await: any; +export { _await as await }; + + +//// [other.js] +export { _await as await }; +//// [index.js] +export {}; diff --git a/tests/baselines/reference/topLevelAwaitErrors.7(module=esnext).symbols b/tests/baselines/reference/topLevelAwaitErrors.7(module=esnext).symbols new file mode 100644 index 0000000000000..4bdcaada48bca --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.7(module=esnext).symbols @@ -0,0 +1,13 @@ +=== tests/cases/conformance/externalModules/index.ts === +// await disallowed in namespace import +import * as await from "./other"; +>await : Symbol(await, Decl(index.ts, 1, 6)) + +=== 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)) + diff --git a/tests/baselines/reference/topLevelAwaitErrors.7(module=esnext).types b/tests/baselines/reference/topLevelAwaitErrors.7(module=esnext).types new file mode 100644 index 0000000000000..88ad9d378a7b6 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.7(module=esnext).types @@ -0,0 +1,13 @@ +=== tests/cases/conformance/externalModules/index.ts === +// await disallowed in namespace import +import * as await from "./other"; +>await : typeof await + +=== tests/cases/conformance/externalModules/other.ts === +declare const _await: any; +>_await : any + +export { _await as await }; +>_await : any +>await : any + diff --git a/tests/baselines/reference/topLevelAwaitErrors.8.errors.txt b/tests/baselines/reference/topLevelAwaitErrors.8(module=es2022).errors.txt similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.8.errors.txt rename to tests/baselines/reference/topLevelAwaitErrors.8(module=es2022).errors.txt diff --git a/tests/baselines/reference/topLevelAwaitErrors.8.js b/tests/baselines/reference/topLevelAwaitErrors.8(module=es2022).js similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.8.js rename to tests/baselines/reference/topLevelAwaitErrors.8(module=es2022).js diff --git a/tests/baselines/reference/topLevelAwaitErrors.8.symbols b/tests/baselines/reference/topLevelAwaitErrors.8(module=es2022).symbols similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.8.symbols rename to tests/baselines/reference/topLevelAwaitErrors.8(module=es2022).symbols diff --git a/tests/baselines/reference/topLevelAwaitErrors.8.types b/tests/baselines/reference/topLevelAwaitErrors.8(module=es2022).types similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.8.types rename to tests/baselines/reference/topLevelAwaitErrors.8(module=es2022).types diff --git a/tests/baselines/reference/topLevelAwaitErrors.8(module=esnext).errors.txt b/tests/baselines/reference/topLevelAwaitErrors.8(module=esnext).errors.txt new file mode 100644 index 0000000000000..ddcc2a7bd655f --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.8(module=esnext).errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/externalModules/index.ts(2,8): 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 default import + import 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 default _await; + \ No newline at end of file diff --git a/tests/baselines/reference/topLevelAwaitErrors.8(module=esnext).js b/tests/baselines/reference/topLevelAwaitErrors.8(module=esnext).js new file mode 100644 index 0000000000000..836b64095a9b8 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.8(module=esnext).js @@ -0,0 +1,15 @@ +//// [tests/cases/conformance/externalModules/topLevelAwaitErrors.8.ts] //// + +//// [index.ts] +// await disallowed in default import +import await from "./other"; + +//// [other.ts] +declare const _await: any; +export default _await; + + +//// [other.js] +export default _await; +//// [index.js] +export {}; diff --git a/tests/baselines/reference/topLevelAwaitErrors.8(module=esnext).symbols b/tests/baselines/reference/topLevelAwaitErrors.8(module=esnext).symbols new file mode 100644 index 0000000000000..5a20ce957d49c --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.8(module=esnext).symbols @@ -0,0 +1,12 @@ +=== tests/cases/conformance/externalModules/index.ts === +// await disallowed in default import +import await from "./other"; +>await : Symbol(await, Decl(index.ts, 1, 6)) + +=== tests/cases/conformance/externalModules/other.ts === +declare const _await: any; +>_await : Symbol(_await, Decl(other.ts, 0, 13)) + +export default _await; +>_await : Symbol(_await, Decl(other.ts, 0, 13)) + diff --git a/tests/baselines/reference/topLevelAwaitErrors.8(module=esnext).types b/tests/baselines/reference/topLevelAwaitErrors.8(module=esnext).types new file mode 100644 index 0000000000000..19df9e0946252 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.8(module=esnext).types @@ -0,0 +1,12 @@ +=== tests/cases/conformance/externalModules/index.ts === +// await disallowed in default import +import await from "./other"; +>await : any + +=== tests/cases/conformance/externalModules/other.ts === +declare const _await: any; +>_await : any + +export default _await; +>_await : any + diff --git a/tests/baselines/reference/topLevelAwaitErrors.9.errors.txt b/tests/baselines/reference/topLevelAwaitErrors.9(module=es2022).errors.txt similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.9.errors.txt rename to tests/baselines/reference/topLevelAwaitErrors.9(module=es2022).errors.txt diff --git a/tests/baselines/reference/topLevelAwaitErrors.9.js b/tests/baselines/reference/topLevelAwaitErrors.9(module=es2022).js similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.9.js rename to tests/baselines/reference/topLevelAwaitErrors.9(module=es2022).js diff --git a/tests/baselines/reference/topLevelAwaitErrors.9.symbols b/tests/baselines/reference/topLevelAwaitErrors.9(module=es2022).symbols similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.9.symbols rename to tests/baselines/reference/topLevelAwaitErrors.9(module=es2022).symbols diff --git a/tests/baselines/reference/topLevelAwaitErrors.9.types b/tests/baselines/reference/topLevelAwaitErrors.9(module=es2022).types similarity index 100% rename from tests/baselines/reference/topLevelAwaitErrors.9.types rename to tests/baselines/reference/topLevelAwaitErrors.9(module=es2022).types diff --git a/tests/baselines/reference/topLevelAwaitErrors.9(module=esnext).errors.txt b/tests/baselines/reference/topLevelAwaitErrors.9(module=esnext).errors.txt new file mode 100644 index 0000000000000..16eea20bebbaf --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.9(module=esnext).errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/externalModules/index.ts(2,10): 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 un-alised named import + import { 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 }; + \ No newline at end of file diff --git a/tests/baselines/reference/topLevelAwaitErrors.9(module=esnext).js b/tests/baselines/reference/topLevelAwaitErrors.9(module=esnext).js new file mode 100644 index 0000000000000..76f86b6d5cbc7 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.9(module=esnext).js @@ -0,0 +1,15 @@ +//// [tests/cases/conformance/externalModules/topLevelAwaitErrors.9.ts] //// + +//// [index.ts] +// await disallowed in un-alised named import +import { await } from "./other"; + +//// [other.ts] +declare const _await: any; +export { _await as await }; + + +//// [other.js] +export { _await as await }; +//// [index.js] +export {}; diff --git a/tests/baselines/reference/topLevelAwaitErrors.9(module=esnext).symbols b/tests/baselines/reference/topLevelAwaitErrors.9(module=esnext).symbols new file mode 100644 index 0000000000000..e1b820fd0ed0d --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.9(module=esnext).symbols @@ -0,0 +1,13 @@ +=== tests/cases/conformance/externalModules/index.ts === +// await disallowed in un-alised named import +import { await } from "./other"; +>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)) + diff --git a/tests/baselines/reference/topLevelAwaitErrors.9(module=esnext).types b/tests/baselines/reference/topLevelAwaitErrors.9(module=esnext).types new file mode 100644 index 0000000000000..e31f8d453f001 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitErrors.9(module=esnext).types @@ -0,0 +1,13 @@ +=== tests/cases/conformance/externalModules/index.ts === +// await disallowed in un-alised named import +import { await } from "./other"; +>await : any + +=== tests/cases/conformance/externalModules/other.ts === +declare const _await: any; +>_await : any + +export { _await as await }; +>_await : any +>await : any + diff --git a/tests/baselines/reference/topLevelAwaitNonModule.errors.txt b/tests/baselines/reference/topLevelAwaitNonModule(module=es2022).errors.txt similarity index 100% rename from tests/baselines/reference/topLevelAwaitNonModule.errors.txt rename to tests/baselines/reference/topLevelAwaitNonModule(module=es2022).errors.txt diff --git a/tests/baselines/reference/topLevelAwaitNonModule.js b/tests/baselines/reference/topLevelAwaitNonModule(module=es2022).js similarity index 100% rename from tests/baselines/reference/topLevelAwaitNonModule.js rename to tests/baselines/reference/topLevelAwaitNonModule(module=es2022).js diff --git a/tests/baselines/reference/topLevelAwaitNonModule.symbols b/tests/baselines/reference/topLevelAwaitNonModule(module=es2022).symbols similarity index 100% rename from tests/baselines/reference/topLevelAwaitNonModule.symbols rename to tests/baselines/reference/topLevelAwaitNonModule(module=es2022).symbols diff --git a/tests/baselines/reference/topLevelAwaitNonModule.types b/tests/baselines/reference/topLevelAwaitNonModule(module=es2022).types similarity index 100% rename from tests/baselines/reference/topLevelAwaitNonModule.types rename to tests/baselines/reference/topLevelAwaitNonModule(module=es2022).types diff --git a/tests/baselines/reference/topLevelAwaitNonModule(module=esnext).errors.txt b/tests/baselines/reference/topLevelAwaitNonModule(module=esnext).errors.txt new file mode 100644 index 0000000000000..fd039af1ea0d0 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitNonModule(module=esnext).errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/externalModules/topLevelAwaitNonModule.ts(1,1): error TS1375: '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. +tests/cases/conformance/externalModules/topLevelAwaitNonModule.ts(1,7): error TS2304: Cannot find name 'x'. +tests/cases/conformance/externalModules/topLevelAwaitNonModule.ts(5,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/externalModules/topLevelAwaitNonModule.ts (3 errors) ==== + await x; + ~~~~~ +!!! error TS1375: '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. + ~ +!!! error TS2304: Cannot find name 'x'. + + const arr = [Promise.resolve()]; + + for await (const item of arr) { + ~~~~~ +!!! 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. + item; + } + \ No newline at end of file diff --git a/tests/baselines/reference/topLevelAwaitNonModule(module=esnext).js b/tests/baselines/reference/topLevelAwaitNonModule(module=esnext).js new file mode 100644 index 0000000000000..fb4ba066f7c74 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitNonModule(module=esnext).js @@ -0,0 +1,16 @@ +//// [topLevelAwaitNonModule.ts] +await x; + +const arr = [Promise.resolve()]; + +for await (const item of arr) { + item; +} + + +//// [topLevelAwaitNonModule.js] +await x; +const arr = [Promise.resolve()]; +for await (const item of arr) { + item; +} diff --git a/tests/baselines/reference/topLevelAwaitNonModule(module=esnext).symbols b/tests/baselines/reference/topLevelAwaitNonModule(module=esnext).symbols new file mode 100644 index 0000000000000..2e6a266f51ac8 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitNonModule(module=esnext).symbols @@ -0,0 +1,17 @@ +=== tests/cases/conformance/externalModules/topLevelAwaitNonModule.ts === +await x; + +const arr = [Promise.resolve()]; +>arr : Symbol(arr, Decl(topLevelAwaitNonModule.ts, 2, 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, --, --), Decl(lib.es2018.promise.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(topLevelAwaitNonModule.ts, 4, 16)) +>arr : Symbol(arr, Decl(topLevelAwaitNonModule.ts, 2, 5)) + + item; +>item : Symbol(item, Decl(topLevelAwaitNonModule.ts, 4, 16)) +} + diff --git a/tests/baselines/reference/topLevelAwaitNonModule(module=esnext).types b/tests/baselines/reference/topLevelAwaitNonModule(module=esnext).types new file mode 100644 index 0000000000000..a6d2b7ed32c07 --- /dev/null +++ b/tests/baselines/reference/topLevelAwaitNonModule(module=esnext).types @@ -0,0 +1,21 @@ +=== tests/cases/conformance/externalModules/topLevelAwaitNonModule.ts === +await x; +>await x : any +>x : any + +const arr = [Promise.resolve()]; +>arr : Promise[] +>[Promise.resolve()] : Promise[] +>Promise.resolve() : Promise +>Promise.resolve : { (): Promise; (value: T | PromiseLike): Promise; } +>Promise : PromiseConstructor +>resolve : { (): Promise; (value: T | PromiseLike): Promise; } + +for await (const item of arr) { +>item : void +>arr : Promise[] + + item; +>item : void +} + diff --git a/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.errors.txt b/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.errors.txt index f4a6f8d147e63..0fecbd4a91647 100644 --- a/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.errors.txt +++ b/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.errors.txt @@ -1,6 +1,6 @@ -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext', 'node12', 'nodenext'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node12', 'nodenext'. -!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext', 'node12', 'nodenext'. +!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node12', 'nodenext'. ==== file.ts (0 errors) ==== \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.oldTranspile.errors.txt b/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.oldTranspile.errors.txt index f4a6f8d147e63..0fecbd4a91647 100644 --- a/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.oldTranspile.errors.txt +++ b/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.oldTranspile.errors.txt @@ -1,6 +1,6 @@ -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext', 'node12', 'nodenext'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node12', 'nodenext'. -!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext', 'node12', 'nodenext'. +!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node12', 'nodenext'. ==== file.ts (0 errors) ==== \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.errors.txt b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.errors.txt index f4a6f8d147e63..0fecbd4a91647 100644 --- a/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.errors.txt +++ b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.errors.txt @@ -1,6 +1,6 @@ -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext', 'node12', 'nodenext'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node12', 'nodenext'. -!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext', 'node12', 'nodenext'. +!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node12', 'nodenext'. ==== file.ts (0 errors) ==== \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.oldTranspile.errors.txt b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.oldTranspile.errors.txt index f4a6f8d147e63..0fecbd4a91647 100644 --- a/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.oldTranspile.errors.txt +++ b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.oldTranspile.errors.txt @@ -1,6 +1,6 @@ -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext', 'node12', 'nodenext'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node12', 'nodenext'. -!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext', 'node12', 'nodenext'. +!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node12', 'nodenext'. ==== file.ts (0 errors) ==== \ No newline at end of file diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js index 059bfc897ca22..100d910dfbaba 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/does-not-add-color-when-NO_COLOR-is-set.js @@ -73,7 +73,7 @@ default: ES3 --module, -m Specify what module code is generated. -one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext, node12, nodenext +one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, node12, nodenext --lib Specify a set of bundled library declaration files that describe the target runtime environment. diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js index 37915984e2233..3b4922b2fe603 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-can't-provide-terminal-width.js @@ -73,7 +73,7 @@ default: ES3 --module, -m Specify what module code is generated. -one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext, node12, nodenext +one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, node12, nodenext --lib Specify a set of bundled library declaration files that describe the target runtime environment. diff --git a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index 37915984e2233..3b4922b2fe603 100644 --- a/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/tests/baselines/reference/tsc/runWithoutArgs/initial-build/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -73,7 +73,7 @@ default: ES3 --module, -m Specify what module code is generated. -one of: none, commonjs, amd, system, umd, es6, es2015, es2020, esnext, node12, nodenext +one of: none, commonjs, amd, system, umd, es6, es2015, es2020, es2022, esnext, node12, nodenext --lib Specify a set of bundled library declaration files that describe the target runtime environment. diff --git a/tests/cases/conformance/externalModules/topLevelAwait.1.ts b/tests/cases/conformance/externalModules/topLevelAwait.1.ts index 9574a49d9ef45..5a93880a5abda 100644 --- a/tests/cases/conformance/externalModules/topLevelAwait.1.ts +++ b/tests/cases/conformance/externalModules/topLevelAwait.1.ts @@ -1,5 +1,5 @@ // @target: es2015,es2017 -// @module: esnext,system +// @module: es2022,esnext,system // @experimentalDecorators: true // @noEmitHelpers: true // @filename: index.ts diff --git a/tests/cases/conformance/externalModules/topLevelAwait.2.ts b/tests/cases/conformance/externalModules/topLevelAwait.2.ts index 25b841d3e8ce3..7fd2c1782a7f2 100644 --- a/tests/cases/conformance/externalModules/topLevelAwait.2.ts +++ b/tests/cases/conformance/externalModules/topLevelAwait.2.ts @@ -1,5 +1,5 @@ // @target: esnext -// @module: esnext +// @module: es2022,esnext declare namespace foo { const await: any; } diff --git a/tests/cases/conformance/externalModules/topLevelAwait.3.ts b/tests/cases/conformance/externalModules/topLevelAwait.3.ts index 1e18814559989..6deeb59afe385 100644 --- a/tests/cases/conformance/externalModules/topLevelAwait.3.ts +++ b/tests/cases/conformance/externalModules/topLevelAwait.3.ts @@ -1,8 +1,8 @@ // @target: esnext -// @module: esnext +// @module: es2022,esnext // @filename: index.d.ts // await keyword allowed as identifier in a declaration file export {}; declare const await: any; -declare class C extends await {} \ No newline at end of file +declare class C extends await {} diff --git a/tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts b/tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts index 72fe5c12ceb78..7ff5f4f5c892a 100644 --- a/tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts +++ b/tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts @@ -1,5 +1,5 @@ // @target: esnext -// @module: esnext +// @module: es2022,esnext // @experimentalDecorators: true // @noEmitHelpers: true diff --git a/tests/cases/conformance/externalModules/topLevelAwaitErrors.10.ts b/tests/cases/conformance/externalModules/topLevelAwaitErrors.10.ts index d418925f202f4..af60e3db79005 100644 --- a/tests/cases/conformance/externalModules/topLevelAwaitErrors.10.ts +++ b/tests/cases/conformance/externalModules/topLevelAwaitErrors.10.ts @@ -1,5 +1,5 @@ // @target: esnext -// @module: esnext +// @module: es2022,esnext // @filename: index.ts // await disallowed in alias of named import diff --git a/tests/cases/conformance/externalModules/topLevelAwaitErrors.12.ts b/tests/cases/conformance/externalModules/topLevelAwaitErrors.12.ts index b884960706256..73c126628bf64 100644 --- a/tests/cases/conformance/externalModules/topLevelAwaitErrors.12.ts +++ b/tests/cases/conformance/externalModules/topLevelAwaitErrors.12.ts @@ -1,5 +1,5 @@ // @target: esnext -// @module: esnext +// @module: es2022,esnext export {}; declare namespace foo { const await: any; } diff --git a/tests/cases/conformance/externalModules/topLevelAwaitErrors.2.ts b/tests/cases/conformance/externalModules/topLevelAwaitErrors.2.ts index 5b963d006ad44..609e374c2cc7e 100644 --- a/tests/cases/conformance/externalModules/topLevelAwaitErrors.2.ts +++ b/tests/cases/conformance/externalModules/topLevelAwaitErrors.2.ts @@ -1,5 +1,5 @@ // @target: esnext -// @module: esnext +// @module: es2022,esnext export {}; diff --git a/tests/cases/conformance/externalModules/topLevelAwaitErrors.3.ts b/tests/cases/conformance/externalModules/topLevelAwaitErrors.3.ts index 4d88141e09b9d..2841a03e0d70a 100644 --- a/tests/cases/conformance/externalModules/topLevelAwaitErrors.3.ts +++ b/tests/cases/conformance/externalModules/topLevelAwaitErrors.3.ts @@ -1,5 +1,5 @@ // @target: esnext -// @module: esnext +// @module: es2022,esnext export {}; diff --git a/tests/cases/conformance/externalModules/topLevelAwaitErrors.4.ts b/tests/cases/conformance/externalModules/topLevelAwaitErrors.4.ts index 99306b5203794..d2216b95ad032 100644 --- a/tests/cases/conformance/externalModules/topLevelAwaitErrors.4.ts +++ b/tests/cases/conformance/externalModules/topLevelAwaitErrors.4.ts @@ -1,5 +1,5 @@ // @target: esnext -// @module: esnext +// @module: es2022,esnext export {}; diff --git a/tests/cases/conformance/externalModules/topLevelAwaitErrors.5.ts b/tests/cases/conformance/externalModules/topLevelAwaitErrors.5.ts index a6c3a8c6aa58d..aa76902829906 100644 --- a/tests/cases/conformance/externalModules/topLevelAwaitErrors.5.ts +++ b/tests/cases/conformance/externalModules/topLevelAwaitErrors.5.ts @@ -1,5 +1,5 @@ // @target: esnext -// @module: esnext +// @module: es2022,esnext // await in exported class name should fail export class await { diff --git a/tests/cases/conformance/externalModules/topLevelAwaitErrors.6.ts b/tests/cases/conformance/externalModules/topLevelAwaitErrors.6.ts index 9ee13de03fb84..ebee5efe3ed39 100644 --- a/tests/cases/conformance/externalModules/topLevelAwaitErrors.6.ts +++ b/tests/cases/conformance/externalModules/topLevelAwaitErrors.6.ts @@ -1,5 +1,5 @@ // @target: esnext -// @module: esnext +// @module: es2022,esnext // await in exported function name should fail export function await() { diff --git a/tests/cases/conformance/externalModules/topLevelAwaitErrors.7.ts b/tests/cases/conformance/externalModules/topLevelAwaitErrors.7.ts index 41c0110522af1..10058cc2d8d41 100644 --- a/tests/cases/conformance/externalModules/topLevelAwaitErrors.7.ts +++ b/tests/cases/conformance/externalModules/topLevelAwaitErrors.7.ts @@ -1,5 +1,5 @@ // @target: esnext -// @module: esnext +// @module: es2022,esnext // @filename: index.ts // await disallowed in namespace import @@ -7,4 +7,4 @@ import * as await from "./other"; // @filename: other.ts declare const _await: any; -export { _await as await }; \ No newline at end of file +export { _await as await }; diff --git a/tests/cases/conformance/externalModules/topLevelAwaitErrors.8.ts b/tests/cases/conformance/externalModules/topLevelAwaitErrors.8.ts index defa012d3d7fb..7f6dcb8e134a7 100644 --- a/tests/cases/conformance/externalModules/topLevelAwaitErrors.8.ts +++ b/tests/cases/conformance/externalModules/topLevelAwaitErrors.8.ts @@ -1,5 +1,5 @@ // @target: esnext -// @module: esnext +// @module: es2022,esnext // @filename: index.ts // await disallowed in default import diff --git a/tests/cases/conformance/externalModules/topLevelAwaitErrors.9.ts b/tests/cases/conformance/externalModules/topLevelAwaitErrors.9.ts index 69e6ffc796c51..7b8d4866927d4 100644 --- a/tests/cases/conformance/externalModules/topLevelAwaitErrors.9.ts +++ b/tests/cases/conformance/externalModules/topLevelAwaitErrors.9.ts @@ -1,5 +1,5 @@ // @target: esnext -// @module: esnext +// @module: es2022,esnext // @filename: index.ts // await disallowed in un-alised named import diff --git a/tests/cases/conformance/externalModules/topLevelAwaitNonModule.ts b/tests/cases/conformance/externalModules/topLevelAwaitNonModule.ts index 8855a53ad8ecc..97d4b3b624134 100644 --- a/tests/cases/conformance/externalModules/topLevelAwaitNonModule.ts +++ b/tests/cases/conformance/externalModules/topLevelAwaitNonModule.ts @@ -1,5 +1,5 @@ // @target: esnext -// @module: esnext +// @module: es2022,esnext await x; const arr = [Promise.resolve()];