Merge branch 'main' into always-suggesting-spelling-correction
This commit is contained in:
commit
fc1a2aa450
14
package-lock.json
generated
14
package-lock.json
generated
|
@ -381,13 +381,13 @@
|
|||
}
|
||||
},
|
||||
"@octokit/rest": {
|
||||
"version": "18.11.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.11.2.tgz",
|
||||
"integrity": "sha512-XZPD5HN0B8AfvXhdztFqoZxNVC6hRgQSZTWS1Eh0xHAoJvduVBwniWJ0t4DsdO9in+odZZ9EYAOFtQuaLVZ44Q==",
|
||||
"version": "18.11.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.11.3.tgz",
|
||||
"integrity": "sha512-k4uCg4PVo6r9ncguSD4fXt6pYkM/FXs7759sYfpvIEhGNPJbFROooOJpkagKPAcSPoEGyEbIR+A9KYIv4jNe4A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@octokit/core": "^3.5.1",
|
||||
"@octokit/plugin-paginate-rest": "^2.16.0",
|
||||
"@octokit/plugin-paginate-rest": "^2.16.4",
|
||||
"@octokit/plugin-request-log": "^1.0.4",
|
||||
"@octokit/plugin-rest-endpoint-methods": "5.11.3"
|
||||
}
|
||||
|
@ -676,9 +676,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "16.10.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.1.tgz",
|
||||
"integrity": "sha512-4/Z9DMPKFexZj/Gn3LylFgamNKHm4K3QDi0gz9B26Uk0c8izYf97B5fxfpspMNkWlFupblKM/nV8+NA9Ffvr+w==",
|
||||
"version": "16.10.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.10.2.tgz",
|
||||
"integrity": "sha512-zCclL4/rx+W5SQTzFs9wyvvyCwoK9QtBpratqz2IYJ3O8Umrn0m3nsTv0wQBk9sRGpvUe9CwPDrQFB10f1FIjQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/node-fetch": {
|
||||
|
|
|
@ -12041,7 +12041,7 @@ namespace ts {
|
|||
else if (type !== firstType) {
|
||||
checkFlags |= CheckFlags.HasNonUniformType;
|
||||
}
|
||||
if (isLiteralType(type)) {
|
||||
if (isLiteralType(type) || isPatternLiteralType(type)) {
|
||||
checkFlags |= CheckFlags.HasLiteralType;
|
||||
}
|
||||
if (type.flags & TypeFlags.Never) {
|
||||
|
@ -19015,6 +19015,9 @@ namespace ts {
|
|||
}
|
||||
else if (target.flags & TypeFlags.TemplateLiteral) {
|
||||
if (source.flags & TypeFlags.TemplateLiteral) {
|
||||
if (relation === comparableRelation) {
|
||||
return templateLiteralTypesDefinitelyUnrelated(source as TemplateLiteralType, target as TemplateLiteralType) ? Ternary.False : Ternary.True;
|
||||
}
|
||||
// Report unreliable variance for type variables referenced in template literal type placeholders.
|
||||
// For example, `foo-${number}` is related to `foo-${string}` even though number isn't related to string.
|
||||
instantiateType(source, makeFunctionTypeMapper(reportUnreliableMarkers));
|
||||
|
@ -19054,11 +19057,10 @@ namespace ts {
|
|||
return result;
|
||||
}
|
||||
}
|
||||
else if (source.flags & TypeFlags.TemplateLiteral) {
|
||||
else if (source.flags & TypeFlags.TemplateLiteral && !(target.flags & TypeFlags.Object)) {
|
||||
if (!(target.flags & TypeFlags.TemplateLiteral)) {
|
||||
const baseConstraint = getBaseConstraintOfType(source);
|
||||
const constraint = baseConstraint && baseConstraint !== source ? baseConstraint : stringType;
|
||||
if (result = isRelatedTo(constraint, target, reportErrors)) {
|
||||
const constraint = getBaseConstraintOfType(source);
|
||||
if (constraint && constraint !== source && (result = isRelatedTo(constraint, target, reportErrors))) {
|
||||
resetErrorInfo(saveErrorInfo);
|
||||
return result;
|
||||
}
|
||||
|
@ -21429,6 +21431,18 @@ namespace ts {
|
|||
return !!(type.symbol && some(type.symbol.declarations, hasSkipDirectInferenceFlag));
|
||||
}
|
||||
|
||||
function templateLiteralTypesDefinitelyUnrelated(source: TemplateLiteralType, target: TemplateLiteralType) {
|
||||
// Two template literal types with diffences in their starting or ending text spans are definitely unrelated.
|
||||
const sourceStart = source.texts[0];
|
||||
const targetStart = target.texts[0];
|
||||
const sourceEnd = source.texts[source.texts.length - 1];
|
||||
const targetEnd = target.texts[target.texts.length - 1];
|
||||
const startLen = Math.min(sourceStart.length, targetStart.length);
|
||||
const endLen = Math.min(sourceEnd.length, targetEnd.length);
|
||||
return sourceStart.slice(0, startLen) !== targetStart.slice(0, startLen) ||
|
||||
sourceEnd.slice(sourceEnd.length - endLen) !== targetEnd.slice(targetEnd.length - endLen);
|
||||
}
|
||||
|
||||
function isValidBigIntString(s: string): boolean {
|
||||
const scanner = createScanner(ScriptTarget.ESNext, /*skipTrivia*/ false);
|
||||
let success = true;
|
||||
|
@ -22529,7 +22543,7 @@ namespace ts {
|
|||
if ((prop as TransientSymbol).isDiscriminantProperty === undefined) {
|
||||
(prop as TransientSymbol).isDiscriminantProperty =
|
||||
((prop as TransientSymbol).checkFlags & CheckFlags.Discriminant) === CheckFlags.Discriminant &&
|
||||
!maybeTypeOfKind(getTypeOfSymbol(prop), TypeFlags.Instantiable & ~TypeFlags.TemplateLiteral);
|
||||
!isGenericType(getTypeOfSymbol(prop));
|
||||
}
|
||||
return !!(prop as TransientSymbol).isDiscriminantProperty;
|
||||
}
|
||||
|
@ -23088,15 +23102,17 @@ namespace ts {
|
|||
return filterType(type, t => (t.flags & kind) !== 0);
|
||||
}
|
||||
|
||||
// Return a new type in which occurrences of the string and number primitive types in
|
||||
// typeWithPrimitives have been replaced with occurrences of string literals and numeric
|
||||
// literals in typeWithLiterals, respectively.
|
||||
// Return a new type in which occurrences of the string, number and bigint primitives and placeholder template
|
||||
// literal types in typeWithPrimitives have been replaced with occurrences of compatible and more specific types
|
||||
// from typeWithLiterals. This is essentially a limited form of intersection between the two types. We avoid a
|
||||
// true intersection because it is more costly and, when applied to union types, generates a large number of
|
||||
// types we don't actually care about.
|
||||
function replacePrimitivesWithLiterals(typeWithPrimitives: Type, typeWithLiterals: Type) {
|
||||
if (isTypeSubsetOf(stringType, typeWithPrimitives) && maybeTypeOfKind(typeWithLiterals, TypeFlags.StringLiteral) ||
|
||||
isTypeSubsetOf(numberType, typeWithPrimitives) && maybeTypeOfKind(typeWithLiterals, TypeFlags.NumberLiteral) ||
|
||||
isTypeSubsetOf(bigintType, typeWithPrimitives) && maybeTypeOfKind(typeWithLiterals, TypeFlags.BigIntLiteral)) {
|
||||
if (maybeTypeOfKind(typeWithPrimitives, TypeFlags.String | TypeFlags.TemplateLiteral | TypeFlags.Number | TypeFlags.BigInt) &&
|
||||
maybeTypeOfKind(typeWithLiterals, TypeFlags.StringLiteral | TypeFlags.TemplateLiteral | TypeFlags.StringMapping | TypeFlags.NumberLiteral | TypeFlags.BigIntLiteral)) {
|
||||
return mapType(typeWithPrimitives, t =>
|
||||
t.flags & TypeFlags.String ? extractTypesOfKind(typeWithLiterals, TypeFlags.String | TypeFlags.StringLiteral) :
|
||||
t.flags & TypeFlags.String ? extractTypesOfKind(typeWithLiterals, TypeFlags.String | TypeFlags.StringLiteral | TypeFlags.TemplateLiteral | TypeFlags.StringMapping) :
|
||||
isPatternLiteralType(t) && !maybeTypeOfKind(typeWithLiterals, TypeFlags.String | TypeFlags.TemplateLiteral | TypeFlags.StringMapping) ? extractTypesOfKind(typeWithLiterals, TypeFlags.StringLiteral) :
|
||||
t.flags & TypeFlags.Number ? extractTypesOfKind(typeWithLiterals, TypeFlags.Number | TypeFlags.NumberLiteral) :
|
||||
t.flags & TypeFlags.BigInt ? extractTypesOfKind(typeWithLiterals, TypeFlags.BigInt | TypeFlags.BigIntLiteral) : t);
|
||||
}
|
||||
|
@ -23939,7 +23955,7 @@ namespace ts {
|
|||
const narrowedPropType = narrowType(propType);
|
||||
return filterType(type, t => {
|
||||
const discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
|
||||
return !(discriminantType.flags & TypeFlags.Never) && isTypeComparableTo(discriminantType, narrowedPropType);
|
||||
return !(narrowedPropType.flags & TypeFlags.Never) && isTypeComparableTo(narrowedPropType, discriminantType);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -31095,16 +31111,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;
|
||||
|
@ -32126,10 +32140,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);
|
||||
}
|
||||
}
|
||||
|
@ -33723,7 +33737,7 @@ namespace ts {
|
|||
}
|
||||
|
||||
function checkParenthesizedExpression(node: ParenthesizedExpression, checkMode?: CheckMode): Type {
|
||||
if (isJSDocTypeAssertion(node)) {
|
||||
if (hasJSDocNodes(node) && isJSDocTypeAssertion(node)) {
|
||||
const type = getJSDocTypeAssertionType(node);
|
||||
return checkAssertionWorker(type, type, node.expression, checkMode);
|
||||
}
|
||||
|
@ -42792,9 +42806,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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43558,7 +43572,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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
},
|
||||
|
|
|
@ -3,6 +3,7 @@ namespace ts {
|
|||
function getModuleTransformer(moduleKind: ModuleKind): TransformerFactory<SourceFile | Bundle> {
|
||||
switch (moduleKind) {
|
||||
case ModuleKind.ESNext:
|
||||
case ModuleKind.ES2022:
|
||||
case ModuleKind.ES2020:
|
||||
case ModuleKind.ES2015:
|
||||
return transformECMAScriptModule;
|
||||
|
|
|
@ -2507,6 +2507,7 @@ namespace ts {
|
|||
|| (isExternalModuleExport(node)
|
||||
&& moduleKind !== ModuleKind.ES2015
|
||||
&& moduleKind !== ModuleKind.ES2020
|
||||
&& moduleKind !== ModuleKind.ES2022
|
||||
&& moduleKind !== ModuleKind.ESNext
|
||||
&& moduleKind !== ModuleKind.System);
|
||||
}
|
||||
|
|
|
@ -6192,6 +6192,7 @@ namespace ts {
|
|||
// module kind).
|
||||
ES2015 = 5,
|
||||
ES2020 = 6,
|
||||
ES2022 = 7,
|
||||
ESNext = 99,
|
||||
|
||||
// Node12+ is an amalgam of commonjs (albeit updated) and es2020+, and represents a distinct module system from es2020/esnext
|
||||
|
|
|
@ -6166,6 +6166,7 @@ namespace ts {
|
|||
case ModuleKind.AMD:
|
||||
case ModuleKind.ES2015:
|
||||
case ModuleKind.ES2020:
|
||||
case ModuleKind.ES2022:
|
||||
case ModuleKind.ESNext:
|
||||
return true;
|
||||
default:
|
||||
|
|
|
@ -13044,12 +13044,18 @@
|
|||
<Item ItemId=";The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Pokud se v příkazu k exportu používá „export type“, nemůžete v pojmenovaném exportu použít modifikátor „type“.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Pokud se v příkazu k importu používá „import type“, nemůžete v pojmenovaném importu použít modifikátor „type“.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
|
|
|
@ -13047,12 +13047,18 @@
|
|||
<Item ItemId=";The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Le ’type’ de modificateur ne peut pas être utilisé sur une importation nommée quand le ’type’ d’exportation est utilisé dans son instruction import.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
<Item ItemId=";The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206" ItemType="0" PsrId="306" Leaf="true">
|
||||
<Str Cat="Text">
|
||||
<Val><![CDATA[The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.]]></Val>
|
||||
<Tgt Cat="Text" Stat="Loc" Orig="New">
|
||||
<Val><![CDATA[Le ’type’ de modificateur ne peut pas être utilisé sur une importation nommée quand le ’type’ d’importation est utilisé dans son instruction import.]]></Val>
|
||||
</Tgt>
|
||||
</Str>
|
||||
<Disp Icon="Str" />
|
||||
</Item>
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -738,6 +738,7 @@ namespace ts.codefix {
|
|||
case ModuleKind.System:
|
||||
case ModuleKind.ES2015:
|
||||
case ModuleKind.ES2020:
|
||||
case ModuleKind.ES2022:
|
||||
case ModuleKind.ESNext:
|
||||
case ModuleKind.None:
|
||||
// Fall back to the `import * as ns` style import.
|
||||
|
|
|
@ -159,7 +159,7 @@ namespace ts {
|
|||
start: undefined,
|
||||
length: undefined,
|
||||
}, {
|
||||
messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext', 'node12', 'nodenext'.",
|
||||
messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node12', 'nodenext'.",
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ namespace ts {
|
|||
file: undefined,
|
||||
start: 0,
|
||||
length: 0,
|
||||
messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'esnext'.",
|
||||
messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext'.",
|
||||
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
|
||||
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category
|
||||
}]
|
||||
|
|
|
@ -3025,6 +3025,7 @@ declare namespace ts {
|
|||
System = 4,
|
||||
ES2015 = 5,
|
||||
ES2020 = 6,
|
||||
ES2022 = 7,
|
||||
ESNext = 99,
|
||||
Node12 = 100,
|
||||
NodeNext = 199
|
||||
|
|
|
@ -3025,6 +3025,7 @@ declare namespace ts {
|
|||
System = 4,
|
||||
ES2015 = 5,
|
||||
ES2020 = 6,
|
||||
ES2022 = 7,
|
||||
ESNext = 99,
|
||||
Node12 = 100,
|
||||
NodeNext = 199
|
||||
|
|
|
@ -12,8 +12,8 @@ tests/cases/compiler/awaitInNonAsyncFunction.ts(30,9): error TS1103: 'for await'
|
|||
tests/cases/compiler/awaitInNonAsyncFunction.ts(31,5): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
|
||||
tests/cases/compiler/awaitInNonAsyncFunction.ts(34,7): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
|
||||
tests/cases/compiler/awaitInNonAsyncFunction.ts(35,5): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
|
||||
tests/cases/compiler/awaitInNonAsyncFunction.ts(39,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/compiler/awaitInNonAsyncFunction.ts(40,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/compiler/awaitInNonAsyncFunction.ts(39,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/compiler/awaitInNonAsyncFunction.ts(40,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
|
||||
|
||||
==== tests/cases/compiler/awaitInNonAsyncFunction.ts (16 errors) ====
|
||||
|
@ -97,7 +97,7 @@ tests/cases/compiler/awaitInNonAsyncFunction.ts(40,1): error TS1378: Top-level '
|
|||
|
||||
for await (const _ of []);
|
||||
~~~~~
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
await null;
|
||||
~~~~~
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
|
@ -0,0 +1,24 @@
|
|||
//// [a.ts]
|
||||
declare var dec: any, __decorate: any;
|
||||
@dec export class A {
|
||||
}
|
||||
|
||||
const o = { a: 1 };
|
||||
const y = { ...o };
|
||||
|
||||
|
||||
//// [a.js]
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
let A = class A {
|
||||
};
|
||||
A = __decorate([
|
||||
dec
|
||||
], A);
|
||||
export { A };
|
||||
const o = { a: 1 };
|
||||
const y = Object.assign({}, o);
|
|
@ -3,15 +3,15 @@ tests/cases/conformance/importAssertion/1.ts(2,28): error TS2821: Import asserti
|
|||
tests/cases/conformance/importAssertion/1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
|
||||
tests/cases/conformance/importAssertion/2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
|
||||
tests/cases/conformance/importAssertion/2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext'.
|
||||
tests/cases/conformance/importAssertion/3.ts(1,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/importAssertion/3.ts(2,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/importAssertion/3.ts(3,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/importAssertion/3.ts(4,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/importAssertion/3.ts(5,12): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/importAssertion/3.ts(7,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/importAssertion/3.ts(8,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/importAssertion/3.ts(9,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/importAssertion/3.ts(10,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/importAssertion/3.ts(1,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/importAssertion/3.ts(2,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/importAssertion/3.ts(3,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/importAssertion/3.ts(4,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/importAssertion/3.ts(5,12): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/importAssertion/3.ts(7,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/importAssertion/3.ts(8,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/importAssertion/3.ts(9,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/importAssertion/3.ts(10,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/importAssertion/0.ts (0 errors) ====
|
||||
|
@ -48,31 +48,31 @@ tests/cases/conformance/importAssertion/3.ts(10,11): error TS1323: Dynamic impor
|
|||
==== tests/cases/conformance/importAssertion/3.ts (9 errors) ====
|
||||
const a = import('./0')
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
const b = import('./0', { assert: { type: "json" } })
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
const d = import('./0', { assert: {} })
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
const dd = import('./0', {})
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
declare function foo(): any;
|
||||
const e = import('./0', foo())
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
const f = import()
|
||||
~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
const g = import('./0', {}, {})
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
const h = import('./0', { assert: { type: "json" }},)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
tests/cases/conformance/dynamicImport/1.ts(1,1): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/dynamicImport/1.ts(2,10): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/dynamicImport/1.ts(8,16): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/dynamicImport/1.ts(1,1): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/dynamicImport/1.ts(2,10): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/dynamicImport/1.ts(8,16): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/dynamicImport/0.ts (0 errors) ====
|
||||
|
@ -9,10 +9,10 @@ tests/cases/conformance/dynamicImport/1.ts(8,16): error TS1323: Dynamic imports
|
|||
==== tests/cases/conformance/dynamicImport/1.ts (3 errors) ====
|
||||
import("./0");
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
var p1 = import("./0");
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
p1.then(zero => {
|
||||
return zero.foo();
|
||||
})
|
||||
|
@ -20,5 +20,5 @@ tests/cases/conformance/dynamicImport/1.ts(8,16): error TS1323: Dynamic imports
|
|||
function foo() {
|
||||
const p2 = import("./0");
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
tests/cases/conformance/dynamicImport/index.ts(2,18): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/dynamicImport/index.ts(2,18): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/dynamicImport/foo.ts (0 errors) ====
|
||||
|
@ -9,7 +9,7 @@ tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic impo
|
|||
async function foo() {
|
||||
return await import((await import("./foo")).default);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
tests/cases/conformance/dynamicImport/index.ts(2,18): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/dynamicImport/index.ts(2,18): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/dynamicImport/foo.ts (0 errors) ====
|
||||
|
@ -9,7 +9,7 @@ tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic impo
|
|||
async function foo() {
|
||||
return await import((await import("./foo")).default);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
~~~~~~~~~~~~~~~
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.
|
||||
}
|
|
@ -1,25 +1,25 @@
|
|||
error TS2468: Cannot find global value 'Promise'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,32): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,32): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,44): error TS2339: Property 'blah' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,51): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,51): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,63): error TS2339: Property 'blue' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,70): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,70): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(2,2): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(6,28): error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,23): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,23): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(1,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(1,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,22): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
|
||||
|
||||
|
@ -31,12 +31,12 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
|
|||
!!! error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option.
|
||||
const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString());
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
const blob = await response.blob();
|
||||
|
||||
const size = import.meta.scriptElement.dataset.size || 300;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'.
|
||||
|
||||
|
@ -50,48 +50,48 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
|
|||
==== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts (5 errors) ====
|
||||
export let x = import.meta;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
export let y = import.metal;
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
~~~~~
|
||||
!!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
export let z = import.import.import.malkovich;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
~~~~~~
|
||||
!!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
|
||||
==== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts (5 errors) ====
|
||||
let globalA = import.meta;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
let globalB = import.metal;
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
~~~~~
|
||||
!!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
let globalC = import.import.import.malkovich;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
~~~~~~
|
||||
!!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
|
||||
==== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts (8 errors) ====
|
||||
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
~~~~
|
||||
!!! error TS2339: Property 'blah' does not exist on type 'ImportMeta'.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
~~~~
|
||||
!!! error TS2339: Property 'blue' does not exist on type 'ImportMeta'.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
import.meta = foo;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
|
||||
|
||||
|
@ -104,4 +104,4 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
|
|||
|
||||
const { a, b, c } = import.meta.wellKnownProperty;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
|
@ -1,25 +1,25 @@
|
|||
error TS2468: Cannot find global value 'Promise'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,32): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,32): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,44): error TS2339: Property 'blah' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,51): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,51): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,63): error TS2339: Property 'blue' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,70): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,70): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(2,2): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/example.ts(6,28): error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,23): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,23): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(1,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(1,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,22): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
|
||||
|
||||
|
@ -31,12 +31,12 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
|
|||
!!! error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option.
|
||||
const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString());
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
const blob = await response.blob();
|
||||
|
||||
const size = import.meta.scriptElement.dataset.size || 300;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'.
|
||||
|
||||
|
@ -50,48 +50,48 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
|
|||
==== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts (5 errors) ====
|
||||
export let x = import.meta;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
export let y = import.metal;
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
~~~~~
|
||||
!!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
export let z = import.import.import.malkovich;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
~~~~~~
|
||||
!!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
|
||||
==== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts (5 errors) ====
|
||||
let globalA = import.meta;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
let globalB = import.metal;
|
||||
~~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
~~~~~
|
||||
!!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
let globalC = import.import.import.malkovich;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
~~~~~~
|
||||
!!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'?
|
||||
|
||||
==== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts (8 errors) ====
|
||||
export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
~~~~
|
||||
!!! error TS2339: Property 'blah' does not exist on type 'ImportMeta'.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
~~~~
|
||||
!!! error TS2339: Property 'blue' does not exist on type 'ImportMeta'.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
import.meta = foo;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access.
|
||||
|
||||
|
@ -104,4 +104,4 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS
|
|||
|
||||
const { a, b, c } = import.meta.wellKnownProperty;
|
||||
~~~~~~~~~~~
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.
|
||||
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
|
26
tests/baselines/reference/jsdocTypeCast.errors.txt
Normal file
26
tests/baselines/reference/jsdocTypeCast.errors.txt
Normal file
|
@ -0,0 +1,26 @@
|
|||
tests/cases/compiler/jsdocTypeCast.js(6,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'.
|
||||
tests/cases/compiler/jsdocTypeCast.js(10,9): error TS2322: Type 'string' is not assignable to type '"a" | "b"'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/jsdocTypeCast.js (2 errors) ====
|
||||
/**
|
||||
* @param {string} x
|
||||
*/
|
||||
function f(x) {
|
||||
/** @type {'a' | 'b'} */
|
||||
let a = (x); // Error
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'.
|
||||
a;
|
||||
|
||||
/** @type {'a' | 'b'} */
|
||||
let b = (((x))); // Error
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"a" | "b"'.
|
||||
b;
|
||||
|
||||
/** @type {'a' | 'b'} */
|
||||
let c = /** @type {'a' | 'b'} */ (x); // Ok
|
||||
c;
|
||||
}
|
||||
|
34
tests/baselines/reference/jsdocTypeCast.js
Normal file
34
tests/baselines/reference/jsdocTypeCast.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
//// [jsdocTypeCast.js]
|
||||
/**
|
||||
* @param {string} x
|
||||
*/
|
||||
function f(x) {
|
||||
/** @type {'a' | 'b'} */
|
||||
let a = (x); // Error
|
||||
a;
|
||||
|
||||
/** @type {'a' | 'b'} */
|
||||
let b = (((x))); // Error
|
||||
b;
|
||||
|
||||
/** @type {'a' | 'b'} */
|
||||
let c = /** @type {'a' | 'b'} */ (x); // Ok
|
||||
c;
|
||||
}
|
||||
|
||||
|
||||
//// [jsdocTypeCast.js]
|
||||
/**
|
||||
* @param {string} x
|
||||
*/
|
||||
function f(x) {
|
||||
/** @type {'a' | 'b'} */
|
||||
var a = (x); // Error
|
||||
a;
|
||||
/** @type {'a' | 'b'} */
|
||||
var b = (((x))); // Error
|
||||
b;
|
||||
/** @type {'a' | 'b'} */
|
||||
var c = /** @type {'a' | 'b'} */ (x); // Ok
|
||||
c;
|
||||
}
|
33
tests/baselines/reference/jsdocTypeCast.symbols
Normal file
33
tests/baselines/reference/jsdocTypeCast.symbols
Normal file
|
@ -0,0 +1,33 @@
|
|||
=== tests/cases/compiler/jsdocTypeCast.js ===
|
||||
/**
|
||||
* @param {string} x
|
||||
*/
|
||||
function f(x) {
|
||||
>f : Symbol(f, Decl(jsdocTypeCast.js, 0, 0))
|
||||
>x : Symbol(x, Decl(jsdocTypeCast.js, 3, 12))
|
||||
|
||||
/** @type {'a' | 'b'} */
|
||||
let a = (x); // Error
|
||||
>a : Symbol(a, Decl(jsdocTypeCast.js, 5, 7))
|
||||
>x : Symbol(x, Decl(jsdocTypeCast.js, 3, 12))
|
||||
|
||||
a;
|
||||
>a : Symbol(a, Decl(jsdocTypeCast.js, 5, 7))
|
||||
|
||||
/** @type {'a' | 'b'} */
|
||||
let b = (((x))); // Error
|
||||
>b : Symbol(b, Decl(jsdocTypeCast.js, 9, 7))
|
||||
>x : Symbol(x, Decl(jsdocTypeCast.js, 3, 12))
|
||||
|
||||
b;
|
||||
>b : Symbol(b, Decl(jsdocTypeCast.js, 9, 7))
|
||||
|
||||
/** @type {'a' | 'b'} */
|
||||
let c = /** @type {'a' | 'b'} */ (x); // Ok
|
||||
>c : Symbol(c, Decl(jsdocTypeCast.js, 13, 7))
|
||||
>x : Symbol(x, Decl(jsdocTypeCast.js, 3, 12))
|
||||
|
||||
c;
|
||||
>c : Symbol(c, Decl(jsdocTypeCast.js, 13, 7))
|
||||
}
|
||||
|
38
tests/baselines/reference/jsdocTypeCast.types
Normal file
38
tests/baselines/reference/jsdocTypeCast.types
Normal file
|
@ -0,0 +1,38 @@
|
|||
=== tests/cases/compiler/jsdocTypeCast.js ===
|
||||
/**
|
||||
* @param {string} x
|
||||
*/
|
||||
function f(x) {
|
||||
>f : (x: string) => void
|
||||
>x : string
|
||||
|
||||
/** @type {'a' | 'b'} */
|
||||
let a = (x); // Error
|
||||
>a : "a" | "b"
|
||||
>(x) : "a" | "b"
|
||||
>x : string
|
||||
|
||||
a;
|
||||
>a : "a" | "b"
|
||||
|
||||
/** @type {'a' | 'b'} */
|
||||
let b = (((x))); // Error
|
||||
>b : "a" | "b"
|
||||
>(((x))) : "a" | "b"
|
||||
>((x)) : string
|
||||
>(x) : string
|
||||
>x : string
|
||||
|
||||
b;
|
||||
>b : "a" | "b"
|
||||
|
||||
/** @type {'a' | 'b'} */
|
||||
let c = /** @type {'a' | 'b'} */ (x); // Ok
|
||||
>c : "a" | "b"
|
||||
>(x) : "a" | "b"
|
||||
>x : string
|
||||
|
||||
c;
|
||||
>c : "a" | "b"
|
||||
}
|
||||
|
|
@ -1,27 +1,27 @@
|
|||
tests/cases/conformance/node/allowJs/index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/allowJs/index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/allowJs/subfolder/index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/allowJs/subfolder/index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/allowJs/index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/allowJs/index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/allowJs/subfolder/index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/allowJs/subfolder/index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/node/allowJs/subfolder/index.js (2 errors) ====
|
||||
// cjs format file
|
||||
const x = await 1;
|
||||
~~~~~
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
export {x};
|
||||
for await (const y of []) {}
|
||||
~~~~~
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
==== tests/cases/conformance/node/allowJs/index.js (2 errors) ====
|
||||
// esm format file
|
||||
const x = await 1;
|
||||
~~~~~
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
export {x};
|
||||
for await (const y of []) {}
|
||||
~~~~~
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
==== tests/cases/conformance/node/allowJs/package.json (0 errors) ====
|
||||
{
|
||||
"name": "package",
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
tests/cases/conformance/node/allowJs/subfolder/index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/allowJs/subfolder/index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/allowJs/subfolder/index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/allowJs/subfolder/index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/node/allowJs/subfolder/index.js (2 errors) ====
|
||||
// cjs format file
|
||||
const x = await 1;
|
||||
~~~~~
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
export {x};
|
||||
for await (const y of []) {}
|
||||
~~~~~
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
==== tests/cases/conformance/node/allowJs/index.js (0 errors) ====
|
||||
// esm format file
|
||||
const x = await 1;
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
tests/cases/conformance/node/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/subfolder/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/subfolder/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/subfolder/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/subfolder/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/node/subfolder/index.ts (2 errors) ====
|
||||
// cjs format file
|
||||
const x = await 1;
|
||||
~~~~~
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
export {x};
|
||||
for await (const y of []) {}
|
||||
~~~~~
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
==== tests/cases/conformance/node/index.ts (2 errors) ====
|
||||
// esm format file
|
||||
const x = await 1;
|
||||
~~~~~
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
export {x};
|
||||
for await (const y of []) {}
|
||||
~~~~~
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
==== tests/cases/conformance/node/package.json (0 errors) ====
|
||||
{
|
||||
"name": "package",
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
tests/cases/conformance/node/subfolder/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/subfolder/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/subfolder/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/node/subfolder/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/node/subfolder/index.ts (2 errors) ====
|
||||
// cjs format file
|
||||
const x = await 1;
|
||||
~~~~~
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
export {x};
|
||||
for await (const y of []) {}
|
||||
~~~~~
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
==== tests/cases/conformance/node/index.ts (0 errors) ====
|
||||
// esm format file
|
||||
const x = await 1;
|
||||
|
|
|
@ -8,10 +8,10 @@ tests/cases/conformance/parser/ecmascript2018/forAwait/inFunctionDeclWithExprIsE
|
|||
tests/cases/conformance/parser/ecmascript2018/forAwait/inGeneratorWithDeclIsError.ts(3,9): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
|
||||
tests/cases/conformance/parser/ecmascript2018/forAwait/inGeneratorWithExprIsError.ts(3,9): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules.
|
||||
tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithDeclIsError.ts(1,5): error TS1431: 'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module.
|
||||
tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithDeclIsError.ts(1,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithDeclIsError.ts(1,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithDeclIsError.ts(1,23): error TS2304: Cannot find name 'y'.
|
||||
tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.ts(1,5): error TS1431: 'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module.
|
||||
tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.ts(1,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.ts(1,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.ts(1,12): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.ts(1,17): error TS2304: Cannot find name 'y'.
|
||||
|
||||
|
@ -21,7 +21,7 @@ tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.t
|
|||
~~~~~
|
||||
!!! error TS1431: 'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module.
|
||||
~~~~~
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'y'.
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.t
|
|||
~~~~~
|
||||
!!! error TS1431: 'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module.
|
||||
~~~~~
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'x'.
|
||||
~
|
||||
|
|
|
@ -5,9 +5,11 @@ tests/cases/conformance/types/literal/templateLiteralTypes3.ts(71,5): error TS23
|
|||
tests/cases/conformance/types/literal/templateLiteralTypes3.ts(72,5): error TS2322: Type '`*${string}*`' is not assignable to type '`*${number}*`'.
|
||||
tests/cases/conformance/types/literal/templateLiteralTypes3.ts(74,5): error TS2322: Type '"*false*" | "*true*"' is not assignable to type '`*${number}*`'.
|
||||
Type '"*false*"' is not assignable to type '`*${number}*`'.
|
||||
tests/cases/conformance/types/literal/templateLiteralTypes3.ts(133,9): error TS2367: This condition will always return 'false' since the types '`foo-${string}`' and '`baz-${string}`' have no overlap.
|
||||
tests/cases/conformance/types/literal/templateLiteralTypes3.ts(141,9): error TS2367: This condition will always return 'false' since the types '`foo-${T}`' and '`baz-${T}`' have no overlap.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/literal/templateLiteralTypes3.ts (6 errors) ====
|
||||
==== tests/cases/conformance/types/literal/templateLiteralTypes3.ts (8 errors) ====
|
||||
// Inference from template literal type to template literal type
|
||||
|
||||
type Foo1<T> = T extends `*${infer U}*` ? U : never;
|
||||
|
@ -146,4 +148,54 @@ tests/cases/conformance/types/literal/templateLiteralTypes3.ts(74,5): error TS23
|
|||
declare function chain<F extends keyof Schema>(field: F | `${F}.${F}`): void;
|
||||
|
||||
chain("a");
|
||||
|
||||
// Repro from #46125
|
||||
|
||||
function ff1(x: `foo-${string}`, y: `${string}-bar`, z: `baz-${string}`) {
|
||||
if (x === y) {
|
||||
x; // `foo-${string}`
|
||||
}
|
||||
if (x === z) { // Error
|
||||
~~~~~~~
|
||||
!!! error TS2367: This condition will always return 'false' since the types '`foo-${string}`' and '`baz-${string}`' have no overlap.
|
||||
}
|
||||
}
|
||||
|
||||
function ff2<T extends string>(x: `foo-${T}`, y: `${T}-bar`, z: `baz-${T}`) {
|
||||
if (x === y) {
|
||||
x; // `foo-${T}`
|
||||
}
|
||||
if (x === z) { // Error
|
||||
~~~~~~~
|
||||
!!! error TS2367: This condition will always return 'false' since the types '`foo-${T}`' and '`baz-${T}`' have no overlap.
|
||||
}
|
||||
}
|
||||
|
||||
function ff3(x: string, y: `foo-${string}` | 'bar') {
|
||||
if (x === y) {
|
||||
x; // `foo-${string}` | 'bar'
|
||||
}
|
||||
}
|
||||
|
||||
function ff4(x: string, y: `foo-${string}`) {
|
||||
if (x === 'foo-test') {
|
||||
x; // 'foo-test'
|
||||
}
|
||||
if (y === 'foo-test') {
|
||||
y; // 'foo-test'
|
||||
}
|
||||
}
|
||||
|
||||
// Repro from #46045
|
||||
|
||||
type Action =
|
||||
| { type: `${string}_REQUEST` }
|
||||
| { type: `${string}_SUCCESS`, response: string };
|
||||
|
||||
function reducer(action: Action) {
|
||||
if (action.type === 'FOO_SUCCESS') {
|
||||
action.type;
|
||||
action.response;
|
||||
}
|
||||
}
|
||||
|
|
@ -124,6 +124,52 @@ type Schema = { a: { b: { c: number } } };
|
|||
declare function chain<F extends keyof Schema>(field: F | `${F}.${F}`): void;
|
||||
|
||||
chain("a");
|
||||
|
||||
// Repro from #46125
|
||||
|
||||
function ff1(x: `foo-${string}`, y: `${string}-bar`, z: `baz-${string}`) {
|
||||
if (x === y) {
|
||||
x; // `foo-${string}`
|
||||
}
|
||||
if (x === z) { // Error
|
||||
}
|
||||
}
|
||||
|
||||
function ff2<T extends string>(x: `foo-${T}`, y: `${T}-bar`, z: `baz-${T}`) {
|
||||
if (x === y) {
|
||||
x; // `foo-${T}`
|
||||
}
|
||||
if (x === z) { // Error
|
||||
}
|
||||
}
|
||||
|
||||
function ff3(x: string, y: `foo-${string}` | 'bar') {
|
||||
if (x === y) {
|
||||
x; // `foo-${string}` | 'bar'
|
||||
}
|
||||
}
|
||||
|
||||
function ff4(x: string, y: `foo-${string}`) {
|
||||
if (x === 'foo-test') {
|
||||
x; // 'foo-test'
|
||||
}
|
||||
if (y === 'foo-test') {
|
||||
y; // 'foo-test'
|
||||
}
|
||||
}
|
||||
|
||||
// Repro from #46045
|
||||
|
||||
type Action =
|
||||
| { type: `${string}_REQUEST` }
|
||||
| { type: `${string}_SUCCESS`, response: string };
|
||||
|
||||
function reducer(action: Action) {
|
||||
if (action.type === 'FOO_SUCCESS') {
|
||||
action.type;
|
||||
action.response;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [templateLiteralTypes3.js]
|
||||
|
@ -177,6 +223,40 @@ var templated1 = value1 + " abc";
|
|||
var value2 = "abc";
|
||||
var templated2 = value2 + " abc";
|
||||
chain("a");
|
||||
// Repro from #46125
|
||||
function ff1(x, y, z) {
|
||||
if (x === y) {
|
||||
x; // `foo-${string}`
|
||||
}
|
||||
if (x === z) { // Error
|
||||
}
|
||||
}
|
||||
function ff2(x, y, z) {
|
||||
if (x === y) {
|
||||
x; // `foo-${T}`
|
||||
}
|
||||
if (x === z) { // Error
|
||||
}
|
||||
}
|
||||
function ff3(x, y) {
|
||||
if (x === y) {
|
||||
x; // `foo-${string}` | 'bar'
|
||||
}
|
||||
}
|
||||
function ff4(x, y) {
|
||||
if (x === 'foo-test') {
|
||||
x; // 'foo-test'
|
||||
}
|
||||
if (y === 'foo-test') {
|
||||
y; // 'foo-test'
|
||||
}
|
||||
}
|
||||
function reducer(action) {
|
||||
if (action.type === 'FOO_SUCCESS') {
|
||||
action.type;
|
||||
action.response;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//// [templateLiteralTypes3.d.ts]
|
||||
|
@ -233,3 +313,14 @@ declare type Schema = {
|
|||
};
|
||||
};
|
||||
declare function chain<F extends keyof Schema>(field: F | `${F}.${F}`): void;
|
||||
declare function ff1(x: `foo-${string}`, y: `${string}-bar`, z: `baz-${string}`): void;
|
||||
declare function ff2<T extends string>(x: `foo-${T}`, y: `${T}-bar`, z: `baz-${T}`): void;
|
||||
declare function ff3(x: string, y: `foo-${string}` | 'bar'): void;
|
||||
declare function ff4(x: string, y: `foo-${string}`): void;
|
||||
declare type Action = {
|
||||
type: `${string}_REQUEST`;
|
||||
} | {
|
||||
type: `${string}_SUCCESS`;
|
||||
response: string;
|
||||
};
|
||||
declare function reducer(action: Action): void;
|
||||
|
|
|
@ -405,3 +405,114 @@ declare function chain<F extends keyof Schema>(field: F | `${F}.${F}`): void;
|
|||
chain("a");
|
||||
>chain : Symbol(chain, Decl(templateLiteralTypes3.ts, 120, 42))
|
||||
|
||||
// Repro from #46125
|
||||
|
||||
function ff1(x: `foo-${string}`, y: `${string}-bar`, z: `baz-${string}`) {
|
||||
>ff1 : Symbol(ff1, Decl(templateLiteralTypes3.ts, 124, 11))
|
||||
>x : Symbol(x, Decl(templateLiteralTypes3.ts, 128, 13))
|
||||
>y : Symbol(y, Decl(templateLiteralTypes3.ts, 128, 32))
|
||||
>z : Symbol(z, Decl(templateLiteralTypes3.ts, 128, 52))
|
||||
|
||||
if (x === y) {
|
||||
>x : Symbol(x, Decl(templateLiteralTypes3.ts, 128, 13))
|
||||
>y : Symbol(y, Decl(templateLiteralTypes3.ts, 128, 32))
|
||||
|
||||
x; // `foo-${string}`
|
||||
>x : Symbol(x, Decl(templateLiteralTypes3.ts, 128, 13))
|
||||
}
|
||||
if (x === z) { // Error
|
||||
>x : Symbol(x, Decl(templateLiteralTypes3.ts, 128, 13))
|
||||
>z : Symbol(z, Decl(templateLiteralTypes3.ts, 128, 52))
|
||||
}
|
||||
}
|
||||
|
||||
function ff2<T extends string>(x: `foo-${T}`, y: `${T}-bar`, z: `baz-${T}`) {
|
||||
>ff2 : Symbol(ff2, Decl(templateLiteralTypes3.ts, 134, 1))
|
||||
>T : Symbol(T, Decl(templateLiteralTypes3.ts, 136, 13))
|
||||
>x : Symbol(x, Decl(templateLiteralTypes3.ts, 136, 31))
|
||||
>T : Symbol(T, Decl(templateLiteralTypes3.ts, 136, 13))
|
||||
>y : Symbol(y, Decl(templateLiteralTypes3.ts, 136, 45))
|
||||
>T : Symbol(T, Decl(templateLiteralTypes3.ts, 136, 13))
|
||||
>z : Symbol(z, Decl(templateLiteralTypes3.ts, 136, 60))
|
||||
>T : Symbol(T, Decl(templateLiteralTypes3.ts, 136, 13))
|
||||
|
||||
if (x === y) {
|
||||
>x : Symbol(x, Decl(templateLiteralTypes3.ts, 136, 31))
|
||||
>y : Symbol(y, Decl(templateLiteralTypes3.ts, 136, 45))
|
||||
|
||||
x; // `foo-${T}`
|
||||
>x : Symbol(x, Decl(templateLiteralTypes3.ts, 136, 31))
|
||||
}
|
||||
if (x === z) { // Error
|
||||
>x : Symbol(x, Decl(templateLiteralTypes3.ts, 136, 31))
|
||||
>z : Symbol(z, Decl(templateLiteralTypes3.ts, 136, 60))
|
||||
}
|
||||
}
|
||||
|
||||
function ff3(x: string, y: `foo-${string}` | 'bar') {
|
||||
>ff3 : Symbol(ff3, Decl(templateLiteralTypes3.ts, 142, 1))
|
||||
>x : Symbol(x, Decl(templateLiteralTypes3.ts, 144, 13))
|
||||
>y : Symbol(y, Decl(templateLiteralTypes3.ts, 144, 23))
|
||||
|
||||
if (x === y) {
|
||||
>x : Symbol(x, Decl(templateLiteralTypes3.ts, 144, 13))
|
||||
>y : Symbol(y, Decl(templateLiteralTypes3.ts, 144, 23))
|
||||
|
||||
x; // `foo-${string}` | 'bar'
|
||||
>x : Symbol(x, Decl(templateLiteralTypes3.ts, 144, 13))
|
||||
}
|
||||
}
|
||||
|
||||
function ff4(x: string, y: `foo-${string}`) {
|
||||
>ff4 : Symbol(ff4, Decl(templateLiteralTypes3.ts, 148, 1))
|
||||
>x : Symbol(x, Decl(templateLiteralTypes3.ts, 150, 13))
|
||||
>y : Symbol(y, Decl(templateLiteralTypes3.ts, 150, 23))
|
||||
|
||||
if (x === 'foo-test') {
|
||||
>x : Symbol(x, Decl(templateLiteralTypes3.ts, 150, 13))
|
||||
|
||||
x; // 'foo-test'
|
||||
>x : Symbol(x, Decl(templateLiteralTypes3.ts, 150, 13))
|
||||
}
|
||||
if (y === 'foo-test') {
|
||||
>y : Symbol(y, Decl(templateLiteralTypes3.ts, 150, 23))
|
||||
|
||||
y; // 'foo-test'
|
||||
>y : Symbol(y, Decl(templateLiteralTypes3.ts, 150, 23))
|
||||
}
|
||||
}
|
||||
|
||||
// Repro from #46045
|
||||
|
||||
type Action =
|
||||
>Action : Symbol(Action, Decl(templateLiteralTypes3.ts, 157, 1))
|
||||
|
||||
| { type: `${string}_REQUEST` }
|
||||
>type : Symbol(type, Decl(templateLiteralTypes3.ts, 162, 7))
|
||||
|
||||
| { type: `${string}_SUCCESS`, response: string };
|
||||
>type : Symbol(type, Decl(templateLiteralTypes3.ts, 163, 7))
|
||||
>response : Symbol(response, Decl(templateLiteralTypes3.ts, 163, 34))
|
||||
|
||||
function reducer(action: Action) {
|
||||
>reducer : Symbol(reducer, Decl(templateLiteralTypes3.ts, 163, 54))
|
||||
>action : Symbol(action, Decl(templateLiteralTypes3.ts, 165, 17))
|
||||
>Action : Symbol(Action, Decl(templateLiteralTypes3.ts, 157, 1))
|
||||
|
||||
if (action.type === 'FOO_SUCCESS') {
|
||||
>action.type : Symbol(type, Decl(templateLiteralTypes3.ts, 162, 7), Decl(templateLiteralTypes3.ts, 163, 7))
|
||||
>action : Symbol(action, Decl(templateLiteralTypes3.ts, 165, 17))
|
||||
>type : Symbol(type, Decl(templateLiteralTypes3.ts, 162, 7), Decl(templateLiteralTypes3.ts, 163, 7))
|
||||
|
||||
action.type;
|
||||
>action.type : Symbol(type, Decl(templateLiteralTypes3.ts, 163, 7))
|
||||
>action : Symbol(action, Decl(templateLiteralTypes3.ts, 165, 17))
|
||||
>type : Symbol(type, Decl(templateLiteralTypes3.ts, 163, 7))
|
||||
|
||||
action.response;
|
||||
>action.response : Symbol(response, Decl(templateLiteralTypes3.ts, 163, 34))
|
||||
>action : Symbol(action, Decl(templateLiteralTypes3.ts, 165, 17))
|
||||
>response : Symbol(response, Decl(templateLiteralTypes3.ts, 163, 34))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -396,3 +396,120 @@ chain("a");
|
|||
>chain : <F extends "a">(field: F | `${F}.${F}`) => void
|
||||
>"a" : "a"
|
||||
|
||||
// Repro from #46125
|
||||
|
||||
function ff1(x: `foo-${string}`, y: `${string}-bar`, z: `baz-${string}`) {
|
||||
>ff1 : (x: `foo-${string}`, y: `${string}-bar`, z: `baz-${string}`) => void
|
||||
>x : `foo-${string}`
|
||||
>y : `${string}-bar`
|
||||
>z : `baz-${string}`
|
||||
|
||||
if (x === y) {
|
||||
>x === y : boolean
|
||||
>x : `foo-${string}`
|
||||
>y : `${string}-bar`
|
||||
|
||||
x; // `foo-${string}`
|
||||
>x : `foo-${string}`
|
||||
}
|
||||
if (x === z) { // Error
|
||||
>x === z : boolean
|
||||
>x : `foo-${string}`
|
||||
>z : `baz-${string}`
|
||||
}
|
||||
}
|
||||
|
||||
function ff2<T extends string>(x: `foo-${T}`, y: `${T}-bar`, z: `baz-${T}`) {
|
||||
>ff2 : <T extends string>(x: `foo-${T}`, y: `${T}-bar`, z: `baz-${T}`) => void
|
||||
>x : `foo-${T}`
|
||||
>y : `${T}-bar`
|
||||
>z : `baz-${T}`
|
||||
|
||||
if (x === y) {
|
||||
>x === y : boolean
|
||||
>x : `foo-${T}`
|
||||
>y : `${T}-bar`
|
||||
|
||||
x; // `foo-${T}`
|
||||
>x : `foo-${T}`
|
||||
}
|
||||
if (x === z) { // Error
|
||||
>x === z : boolean
|
||||
>x : `foo-${T}`
|
||||
>z : `baz-${T}`
|
||||
}
|
||||
}
|
||||
|
||||
function ff3(x: string, y: `foo-${string}` | 'bar') {
|
||||
>ff3 : (x: string, y: `foo-${string}` | 'bar') => void
|
||||
>x : string
|
||||
>y : "bar" | `foo-${string}`
|
||||
|
||||
if (x === y) {
|
||||
>x === y : boolean
|
||||
>x : string
|
||||
>y : "bar" | `foo-${string}`
|
||||
|
||||
x; // `foo-${string}` | 'bar'
|
||||
>x : "bar" | `foo-${string}`
|
||||
}
|
||||
}
|
||||
|
||||
function ff4(x: string, y: `foo-${string}`) {
|
||||
>ff4 : (x: string, y: `foo-${string}`) => void
|
||||
>x : string
|
||||
>y : `foo-${string}`
|
||||
|
||||
if (x === 'foo-test') {
|
||||
>x === 'foo-test' : boolean
|
||||
>x : string
|
||||
>'foo-test' : "foo-test"
|
||||
|
||||
x; // 'foo-test'
|
||||
>x : "foo-test"
|
||||
}
|
||||
if (y === 'foo-test') {
|
||||
>y === 'foo-test' : boolean
|
||||
>y : `foo-${string}`
|
||||
>'foo-test' : "foo-test"
|
||||
|
||||
y; // 'foo-test'
|
||||
>y : "foo-test"
|
||||
}
|
||||
}
|
||||
|
||||
// Repro from #46045
|
||||
|
||||
type Action =
|
||||
>Action : Action
|
||||
|
||||
| { type: `${string}_REQUEST` }
|
||||
>type : `${string}_REQUEST`
|
||||
|
||||
| { type: `${string}_SUCCESS`, response: string };
|
||||
>type : `${string}_SUCCESS`
|
||||
>response : string
|
||||
|
||||
function reducer(action: Action) {
|
||||
>reducer : (action: Action) => void
|
||||
>action : Action
|
||||
|
||||
if (action.type === 'FOO_SUCCESS') {
|
||||
>action.type === 'FOO_SUCCESS' : boolean
|
||||
>action.type : `${string}_REQUEST` | `${string}_SUCCESS`
|
||||
>action : Action
|
||||
>type : `${string}_REQUEST` | `${string}_SUCCESS`
|
||||
>'FOO_SUCCESS' : "FOO_SUCCESS"
|
||||
|
||||
action.type;
|
||||
>action.type : "FOO_SUCCESS"
|
||||
>action : { type: `${string}_SUCCESS`; response: string; }
|
||||
>type : "FOO_SUCCESS"
|
||||
|
||||
action.response;
|
||||
>action.response : string
|
||||
>action : { type: `${string}_SUCCESS`; response: string; }
|
||||
>response : string
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
tests/cases/conformance/externalModules/index.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/externalModules/index.ts(46,3): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/index.ts (2 errors) ====
|
||||
export const x = 1;
|
||||
await x;
|
||||
~~~~~
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
|
||||
// reparse element access as await
|
||||
await [x];
|
||||
await [x, x];
|
||||
|
||||
// reparse call as await
|
||||
declare function f(): number;
|
||||
await (x);
|
||||
await (f(), x);
|
||||
await <number>(x);
|
||||
await <number>(f(), x);
|
||||
|
||||
// reparse tagged template as await
|
||||
await ``;
|
||||
await <string> ``;
|
||||
|
||||
// member names should be ok
|
||||
class C1 {
|
||||
await() {}
|
||||
}
|
||||
class C2 {
|
||||
get await() { return 1; }
|
||||
set await(value) { }
|
||||
}
|
||||
class C3 {
|
||||
await = 1;
|
||||
}
|
||||
({
|
||||
await() {}
|
||||
});
|
||||
({
|
||||
get await() { return 1 },
|
||||
set await(value) { }
|
||||
});
|
||||
({
|
||||
await: 1
|
||||
});
|
||||
|
||||
// property access name should be ok
|
||||
C1.prototype.await;
|
||||
|
||||
// await in decorators
|
||||
declare const dec: any;
|
||||
@(await dec)
|
||||
~~~~~
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
class C {
|
||||
}
|
||||
|
||||
// await allowed in aliased import
|
||||
import { await as _await } from "./other";
|
||||
|
||||
// newlines
|
||||
// await in throw
|
||||
throw await
|
||||
1;
|
||||
|
||||
// await in var
|
||||
let y = await
|
||||
1;
|
||||
|
||||
// await in expression statement;
|
||||
await
|
||||
1;
|
||||
|
||||
==== tests/cases/conformance/externalModules/other.ts (1 errors) ====
|
||||
const _await = 1;
|
||||
|
||||
// await allowed in aliased export
|
||||
export { _await as await };
|
||||
|
||||
// for-await-of
|
||||
const arr = [Promise.resolve()];
|
||||
|
||||
for await (const item of arr) {
|
||||
~~~~~
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
item;
|
||||
}
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
//// [tests/cases/conformance/externalModules/topLevelAwait.1.ts] ////
|
||||
|
||||
//// [index.ts]
|
||||
export const x = 1;
|
||||
await x;
|
||||
|
||||
// reparse element access as await
|
||||
await [x];
|
||||
await [x, x];
|
||||
|
||||
// reparse call as await
|
||||
declare function f(): number;
|
||||
await (x);
|
||||
await (f(), x);
|
||||
await <number>(x);
|
||||
await <number>(f(), x);
|
||||
|
||||
// reparse tagged template as await
|
||||
await ``;
|
||||
await <string> ``;
|
||||
|
||||
// member names should be ok
|
||||
class C1 {
|
||||
await() {}
|
||||
}
|
||||
class C2 {
|
||||
get await() { return 1; }
|
||||
set await(value) { }
|
||||
}
|
||||
class C3 {
|
||||
await = 1;
|
||||
}
|
||||
({
|
||||
await() {}
|
||||
});
|
||||
({
|
||||
get await() { return 1 },
|
||||
set await(value) { }
|
||||
});
|
||||
({
|
||||
await: 1
|
||||
});
|
||||
|
||||
// property access name should be ok
|
||||
C1.prototype.await;
|
||||
|
||||
// await in decorators
|
||||
declare const dec: any;
|
||||
@(await dec)
|
||||
class C {
|
||||
}
|
||||
|
||||
// await allowed in aliased import
|
||||
import { await as _await } from "./other";
|
||||
|
||||
// newlines
|
||||
// await in throw
|
||||
throw await
|
||||
1;
|
||||
|
||||
// await in var
|
||||
let y = await
|
||||
1;
|
||||
|
||||
// await in expression statement;
|
||||
await
|
||||
1;
|
||||
|
||||
//// [other.ts]
|
||||
const _await = 1;
|
||||
|
||||
// await allowed in aliased export
|
||||
export { _await as await };
|
||||
|
||||
// for-await-of
|
||||
const arr = [Promise.resolve()];
|
||||
|
||||
for await (const item of arr) {
|
||||
item;
|
||||
}
|
||||
|
||||
|
||||
//// [other.js]
|
||||
var e_1, _a;
|
||||
const _await = 1;
|
||||
// await allowed in aliased export
|
||||
export { _await as await };
|
||||
// for-await-of
|
||||
const arr = [Promise.resolve()];
|
||||
try {
|
||||
for (var arr_1 = __asyncValues(arr), arr_1_1; arr_1_1 = await arr_1.next(), !arr_1_1.done;) {
|
||||
const item = arr_1_1.value;
|
||||
item;
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (arr_1_1 && !arr_1_1.done && (_a = arr_1.return)) await _a.call(arr_1);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
//// [index.js]
|
||||
export const x = 1;
|
||||
await x;
|
||||
// reparse element access as await
|
||||
await [x];
|
||||
await [x, x];
|
||||
await (x);
|
||||
await (f(), x);
|
||||
await (x);
|
||||
await (f(), x);
|
||||
// reparse tagged template as await
|
||||
await ``;
|
||||
await ``;
|
||||
// member names should be ok
|
||||
class C1 {
|
||||
await() { }
|
||||
}
|
||||
class C2 {
|
||||
get await() { return 1; }
|
||||
set await(value) { }
|
||||
}
|
||||
class C3 {
|
||||
constructor() {
|
||||
this.await = 1;
|
||||
}
|
||||
}
|
||||
({
|
||||
await() { }
|
||||
});
|
||||
({
|
||||
get await() { return 1; },
|
||||
set await(value) { }
|
||||
});
|
||||
({
|
||||
await: 1
|
||||
});
|
||||
// property access name should be ok
|
||||
C1.prototype.await;
|
||||
let C = class C {
|
||||
};
|
||||
C = __decorate([
|
||||
(await dec)
|
||||
], C);
|
||||
// newlines
|
||||
// await in throw
|
||||
throw await 1;
|
||||
// await in var
|
||||
let y = await 1;
|
||||
// await in expression statement;
|
||||
await 1;
|
|
@ -0,0 +1,143 @@
|
|||
=== tests/cases/conformance/externalModules/index.ts ===
|
||||
export const x = 1;
|
||||
>x : Symbol(x, Decl(index.ts, 0, 12))
|
||||
|
||||
await x;
|
||||
>x : Symbol(x, Decl(index.ts, 0, 12))
|
||||
|
||||
// reparse element access as await
|
||||
await [x];
|
||||
>x : Symbol(x, Decl(index.ts, 0, 12))
|
||||
|
||||
await [x, x];
|
||||
>x : Symbol(x, Decl(index.ts, 0, 12))
|
||||
>x : Symbol(x, Decl(index.ts, 0, 12))
|
||||
|
||||
// reparse call as await
|
||||
declare function f(): number;
|
||||
>f : Symbol(f, Decl(index.ts, 5, 13))
|
||||
|
||||
await (x);
|
||||
>x : Symbol(x, Decl(index.ts, 0, 12))
|
||||
|
||||
await (f(), x);
|
||||
>f : Symbol(f, Decl(index.ts, 5, 13))
|
||||
>x : Symbol(x, Decl(index.ts, 0, 12))
|
||||
|
||||
await <number>(x);
|
||||
>x : Symbol(x, Decl(index.ts, 0, 12))
|
||||
|
||||
await <number>(f(), x);
|
||||
>f : Symbol(f, Decl(index.ts, 5, 13))
|
||||
>x : Symbol(x, Decl(index.ts, 0, 12))
|
||||
|
||||
// reparse tagged template as await
|
||||
await ``;
|
||||
await <string> ``;
|
||||
|
||||
// member names should be ok
|
||||
class C1 {
|
||||
>C1 : Symbol(C1, Decl(index.ts, 16, 18))
|
||||
|
||||
await() {}
|
||||
>await : Symbol(C1.await, Decl(index.ts, 19, 10))
|
||||
}
|
||||
class C2 {
|
||||
>C2 : Symbol(C2, Decl(index.ts, 21, 1))
|
||||
|
||||
get await() { return 1; }
|
||||
>await : Symbol(C2.await, Decl(index.ts, 22, 10), Decl(index.ts, 23, 29))
|
||||
|
||||
set await(value) { }
|
||||
>await : Symbol(C2.await, Decl(index.ts, 22, 10), Decl(index.ts, 23, 29))
|
||||
>value : Symbol(value, Decl(index.ts, 24, 14))
|
||||
}
|
||||
class C3 {
|
||||
>C3 : Symbol(C3, Decl(index.ts, 25, 1))
|
||||
|
||||
await = 1;
|
||||
>await : Symbol(C3.await, Decl(index.ts, 26, 10))
|
||||
}
|
||||
({
|
||||
await() {}
|
||||
>await : Symbol(await, Decl(index.ts, 29, 2))
|
||||
|
||||
});
|
||||
({
|
||||
get await() { return 1 },
|
||||
>await : Symbol(await, Decl(index.ts, 32, 2), Decl(index.ts, 33, 29))
|
||||
|
||||
set await(value) { }
|
||||
>await : Symbol(await, Decl(index.ts, 32, 2), Decl(index.ts, 33, 29))
|
||||
>value : Symbol(value, Decl(index.ts, 34, 14))
|
||||
|
||||
});
|
||||
({
|
||||
await: 1
|
||||
>await : Symbol(await, Decl(index.ts, 36, 2))
|
||||
|
||||
});
|
||||
|
||||
// property access name should be ok
|
||||
C1.prototype.await;
|
||||
>C1.prototype.await : Symbol(C1.await, Decl(index.ts, 19, 10))
|
||||
>C1.prototype : Symbol(C1.prototype)
|
||||
>C1 : Symbol(C1, Decl(index.ts, 16, 18))
|
||||
>prototype : Symbol(C1.prototype)
|
||||
>await : Symbol(C1.await, Decl(index.ts, 19, 10))
|
||||
|
||||
// await in decorators
|
||||
declare const dec: any;
|
||||
>dec : Symbol(dec, Decl(index.ts, 44, 13))
|
||||
|
||||
@(await dec)
|
||||
>dec : Symbol(dec, Decl(index.ts, 44, 13))
|
||||
|
||||
class C {
|
||||
>C : Symbol(C, Decl(index.ts, 44, 23))
|
||||
}
|
||||
|
||||
// await allowed in aliased import
|
||||
import { await as _await } from "./other";
|
||||
>await : Symbol(await, Decl(other.ts, 3, 8))
|
||||
>_await : Symbol(_await, Decl(index.ts, 50, 8))
|
||||
|
||||
// newlines
|
||||
// await in throw
|
||||
throw await
|
||||
1;
|
||||
|
||||
// await in var
|
||||
let y = await
|
||||
>y : Symbol(y, Decl(index.ts, 58, 3))
|
||||
|
||||
1;
|
||||
|
||||
// await in expression statement;
|
||||
await
|
||||
1;
|
||||
|
||||
=== tests/cases/conformance/externalModules/other.ts ===
|
||||
const _await = 1;
|
||||
>_await : Symbol(_await, Decl(other.ts, 0, 5))
|
||||
|
||||
// await allowed in aliased export
|
||||
export { _await as await };
|
||||
>_await : Symbol(_await, Decl(other.ts, 0, 5))
|
||||
>await : Symbol(await, Decl(other.ts, 3, 8))
|
||||
|
||||
// for-await-of
|
||||
const arr = [Promise.resolve()];
|
||||
>arr : Symbol(arr, Decl(other.ts, 6, 5))
|
||||
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
|
||||
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
|
||||
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
|
||||
|
||||
for await (const item of arr) {
|
||||
>item : Symbol(item, Decl(other.ts, 8, 16))
|
||||
>arr : Symbol(arr, Decl(other.ts, 6, 5))
|
||||
|
||||
item;
|
||||
>item : Symbol(item, Decl(other.ts, 8, 16))
|
||||
}
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
=== tests/cases/conformance/externalModules/index.ts ===
|
||||
export const x = 1;
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
await x;
|
||||
>await x : 1
|
||||
>x : 1
|
||||
|
||||
// reparse element access as await
|
||||
await [x];
|
||||
>await [x] : number[]
|
||||
>[x] : number[]
|
||||
>x : 1
|
||||
|
||||
await [x, x];
|
||||
>await [x, x] : number[]
|
||||
>[x, x] : number[]
|
||||
>x : 1
|
||||
>x : 1
|
||||
|
||||
// reparse call as await
|
||||
declare function f(): number;
|
||||
>f : () => number
|
||||
|
||||
await (x);
|
||||
>await (x) : 1
|
||||
>(x) : 1
|
||||
>x : 1
|
||||
|
||||
await (f(), x);
|
||||
>await (f(), x) : 1
|
||||
>(f(), x) : 1
|
||||
>f(), x : 1
|
||||
>f() : number
|
||||
>f : () => number
|
||||
>x : 1
|
||||
|
||||
await <number>(x);
|
||||
>await <number>(x) : number
|
||||
><number>(x) : number
|
||||
>(x) : 1
|
||||
>x : 1
|
||||
|
||||
await <number>(f(), x);
|
||||
>await <number>(f(), x) : number
|
||||
><number>(f(), x) : number
|
||||
>(f(), x) : 1
|
||||
>f(), x : 1
|
||||
>f() : number
|
||||
>f : () => number
|
||||
>x : 1
|
||||
|
||||
// reparse tagged template as await
|
||||
await ``;
|
||||
>await `` : ""
|
||||
>`` : ""
|
||||
|
||||
await <string> ``;
|
||||
>await <string> `` : string
|
||||
><string> `` : string
|
||||
>`` : ""
|
||||
|
||||
// member names should be ok
|
||||
class C1 {
|
||||
>C1 : C1
|
||||
|
||||
await() {}
|
||||
>await : () => void
|
||||
}
|
||||
class C2 {
|
||||
>C2 : C2
|
||||
|
||||
get await() { return 1; }
|
||||
>await : number
|
||||
>1 : 1
|
||||
|
||||
set await(value) { }
|
||||
>await : number
|
||||
>value : number
|
||||
}
|
||||
class C3 {
|
||||
>C3 : C3
|
||||
|
||||
await = 1;
|
||||
>await : number
|
||||
>1 : 1
|
||||
}
|
||||
({
|
||||
>({ await() {}}) : { await(): void; }
|
||||
>{ await() {}} : { await(): void; }
|
||||
|
||||
await() {}
|
||||
>await : () => void
|
||||
|
||||
});
|
||||
({
|
||||
>({ get await() { return 1 }, set await(value) { }}) : { await: number; }
|
||||
>{ get await() { return 1 }, set await(value) { }} : { await: number; }
|
||||
|
||||
get await() { return 1 },
|
||||
>await : number
|
||||
>1 : 1
|
||||
|
||||
set await(value) { }
|
||||
>await : number
|
||||
>value : number
|
||||
|
||||
});
|
||||
({
|
||||
>({ await: 1}) : { await: number; }
|
||||
>{ await: 1} : { await: number; }
|
||||
|
||||
await: 1
|
||||
>await : number
|
||||
>1 : 1
|
||||
|
||||
});
|
||||
|
||||
// property access name should be ok
|
||||
C1.prototype.await;
|
||||
>C1.prototype.await : () => void
|
||||
>C1.prototype : C1
|
||||
>C1 : typeof C1
|
||||
>prototype : C1
|
||||
>await : () => void
|
||||
|
||||
// await in decorators
|
||||
declare const dec: any;
|
||||
>dec : any
|
||||
|
||||
@(await dec)
|
||||
>(await dec) : any
|
||||
>await dec : any
|
||||
>dec : any
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
}
|
||||
|
||||
// await allowed in aliased import
|
||||
import { await as _await } from "./other";
|
||||
>await : 1
|
||||
>_await : 1
|
||||
|
||||
// newlines
|
||||
// await in throw
|
||||
throw await
|
||||
>await 1 : 1
|
||||
|
||||
1;
|
||||
>1 : 1
|
||||
|
||||
// await in var
|
||||
let y = await
|
||||
>y : number
|
||||
>await 1 : 1
|
||||
|
||||
1;
|
||||
>1 : 1
|
||||
|
||||
// await in expression statement;
|
||||
await
|
||||
>await 1 : 1
|
||||
|
||||
1;
|
||||
>1 : 1
|
||||
|
||||
=== tests/cases/conformance/externalModules/other.ts ===
|
||||
const _await = 1;
|
||||
>_await : 1
|
||||
>1 : 1
|
||||
|
||||
// await allowed in aliased export
|
||||
export { _await as await };
|
||||
>_await : 1
|
||||
>await : 1
|
||||
|
||||
// for-await-of
|
||||
const arr = [Promise.resolve()];
|
||||
>arr : Promise<void>[]
|
||||
>[Promise.resolve()] : Promise<void>[]
|
||||
>Promise.resolve() : Promise<void>
|
||||
>Promise.resolve : { (): Promise<void>; <T>(value: T | PromiseLike<T>): Promise<T>; }
|
||||
>Promise : PromiseConstructor
|
||||
>resolve : { (): Promise<void>; <T>(value: T | PromiseLike<T>): Promise<T>; }
|
||||
|
||||
for await (const item of arr) {
|
||||
>item : void
|
||||
>arr : Promise<void>[]
|
||||
|
||||
item;
|
||||
>item : void
|
||||
}
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
//// [tests/cases/conformance/externalModules/topLevelAwait.1.ts] ////
|
||||
|
||||
//// [index.ts]
|
||||
export const x = 1;
|
||||
await x;
|
||||
|
||||
// reparse element access as await
|
||||
await [x];
|
||||
await [x, x];
|
||||
|
||||
// reparse call as await
|
||||
declare function f(): number;
|
||||
await (x);
|
||||
await (f(), x);
|
||||
await <number>(x);
|
||||
await <number>(f(), x);
|
||||
|
||||
// reparse tagged template as await
|
||||
await ``;
|
||||
await <string> ``;
|
||||
|
||||
// member names should be ok
|
||||
class C1 {
|
||||
await() {}
|
||||
}
|
||||
class C2 {
|
||||
get await() { return 1; }
|
||||
set await(value) { }
|
||||
}
|
||||
class C3 {
|
||||
await = 1;
|
||||
}
|
||||
({
|
||||
await() {}
|
||||
});
|
||||
({
|
||||
get await() { return 1 },
|
||||
set await(value) { }
|
||||
});
|
||||
({
|
||||
await: 1
|
||||
});
|
||||
|
||||
// property access name should be ok
|
||||
C1.prototype.await;
|
||||
|
||||
// await in decorators
|
||||
declare const dec: any;
|
||||
@(await dec)
|
||||
class C {
|
||||
}
|
||||
|
||||
// await allowed in aliased import
|
||||
import { await as _await } from "./other";
|
||||
|
||||
// newlines
|
||||
// await in throw
|
||||
throw await
|
||||
1;
|
||||
|
||||
// await in var
|
||||
let y = await
|
||||
1;
|
||||
|
||||
// await in expression statement;
|
||||
await
|
||||
1;
|
||||
|
||||
//// [other.ts]
|
||||
const _await = 1;
|
||||
|
||||
// await allowed in aliased export
|
||||
export { _await as await };
|
||||
|
||||
// for-await-of
|
||||
const arr = [Promise.resolve()];
|
||||
|
||||
for await (const item of arr) {
|
||||
item;
|
||||
}
|
||||
|
||||
|
||||
//// [other.js]
|
||||
var e_1, _a;
|
||||
const _await = 1;
|
||||
// await allowed in aliased export
|
||||
export { _await as await };
|
||||
// for-await-of
|
||||
const arr = [Promise.resolve()];
|
||||
try {
|
||||
for (var arr_1 = __asyncValues(arr), arr_1_1; arr_1_1 = await arr_1.next(), !arr_1_1.done;) {
|
||||
const item = arr_1_1.value;
|
||||
item;
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (arr_1_1 && !arr_1_1.done && (_a = arr_1.return)) await _a.call(arr_1);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
//// [index.js]
|
||||
export const x = 1;
|
||||
await x;
|
||||
// reparse element access as await
|
||||
await [x];
|
||||
await [x, x];
|
||||
await (x);
|
||||
await (f(), x);
|
||||
await (x);
|
||||
await (f(), x);
|
||||
// reparse tagged template as await
|
||||
await ``;
|
||||
await ``;
|
||||
// member names should be ok
|
||||
class C1 {
|
||||
await() { }
|
||||
}
|
||||
class C2 {
|
||||
get await() { return 1; }
|
||||
set await(value) { }
|
||||
}
|
||||
class C3 {
|
||||
constructor() {
|
||||
this.await = 1;
|
||||
}
|
||||
}
|
||||
({
|
||||
await() { }
|
||||
});
|
||||
({
|
||||
get await() { return 1; },
|
||||
set await(value) { }
|
||||
});
|
||||
({
|
||||
await: 1
|
||||
});
|
||||
// property access name should be ok
|
||||
C1.prototype.await;
|
||||
let C = class C {
|
||||
};
|
||||
C = __decorate([
|
||||
(await dec)
|
||||
], C);
|
||||
// newlines
|
||||
// await in throw
|
||||
throw await 1;
|
||||
// await in var
|
||||
let y = await 1;
|
||||
// await in expression statement;
|
||||
await 1;
|
|
@ -0,0 +1,143 @@
|
|||
=== tests/cases/conformance/externalModules/index.ts ===
|
||||
export const x = 1;
|
||||
>x : Symbol(x, Decl(index.ts, 0, 12))
|
||||
|
||||
await x;
|
||||
>x : Symbol(x, Decl(index.ts, 0, 12))
|
||||
|
||||
// reparse element access as await
|
||||
await [x];
|
||||
>x : Symbol(x, Decl(index.ts, 0, 12))
|
||||
|
||||
await [x, x];
|
||||
>x : Symbol(x, Decl(index.ts, 0, 12))
|
||||
>x : Symbol(x, Decl(index.ts, 0, 12))
|
||||
|
||||
// reparse call as await
|
||||
declare function f(): number;
|
||||
>f : Symbol(f, Decl(index.ts, 5, 13))
|
||||
|
||||
await (x);
|
||||
>x : Symbol(x, Decl(index.ts, 0, 12))
|
||||
|
||||
await (f(), x);
|
||||
>f : Symbol(f, Decl(index.ts, 5, 13))
|
||||
>x : Symbol(x, Decl(index.ts, 0, 12))
|
||||
|
||||
await <number>(x);
|
||||
>x : Symbol(x, Decl(index.ts, 0, 12))
|
||||
|
||||
await <number>(f(), x);
|
||||
>f : Symbol(f, Decl(index.ts, 5, 13))
|
||||
>x : Symbol(x, Decl(index.ts, 0, 12))
|
||||
|
||||
// reparse tagged template as await
|
||||
await ``;
|
||||
await <string> ``;
|
||||
|
||||
// member names should be ok
|
||||
class C1 {
|
||||
>C1 : Symbol(C1, Decl(index.ts, 16, 18))
|
||||
|
||||
await() {}
|
||||
>await : Symbol(C1.await, Decl(index.ts, 19, 10))
|
||||
}
|
||||
class C2 {
|
||||
>C2 : Symbol(C2, Decl(index.ts, 21, 1))
|
||||
|
||||
get await() { return 1; }
|
||||
>await : Symbol(C2.await, Decl(index.ts, 22, 10), Decl(index.ts, 23, 29))
|
||||
|
||||
set await(value) { }
|
||||
>await : Symbol(C2.await, Decl(index.ts, 22, 10), Decl(index.ts, 23, 29))
|
||||
>value : Symbol(value, Decl(index.ts, 24, 14))
|
||||
}
|
||||
class C3 {
|
||||
>C3 : Symbol(C3, Decl(index.ts, 25, 1))
|
||||
|
||||
await = 1;
|
||||
>await : Symbol(C3.await, Decl(index.ts, 26, 10))
|
||||
}
|
||||
({
|
||||
await() {}
|
||||
>await : Symbol(await, Decl(index.ts, 29, 2))
|
||||
|
||||
});
|
||||
({
|
||||
get await() { return 1 },
|
||||
>await : Symbol(await, Decl(index.ts, 32, 2), Decl(index.ts, 33, 29))
|
||||
|
||||
set await(value) { }
|
||||
>await : Symbol(await, Decl(index.ts, 32, 2), Decl(index.ts, 33, 29))
|
||||
>value : Symbol(value, Decl(index.ts, 34, 14))
|
||||
|
||||
});
|
||||
({
|
||||
await: 1
|
||||
>await : Symbol(await, Decl(index.ts, 36, 2))
|
||||
|
||||
});
|
||||
|
||||
// property access name should be ok
|
||||
C1.prototype.await;
|
||||
>C1.prototype.await : Symbol(C1.await, Decl(index.ts, 19, 10))
|
||||
>C1.prototype : Symbol(C1.prototype)
|
||||
>C1 : Symbol(C1, Decl(index.ts, 16, 18))
|
||||
>prototype : Symbol(C1.prototype)
|
||||
>await : Symbol(C1.await, Decl(index.ts, 19, 10))
|
||||
|
||||
// await in decorators
|
||||
declare const dec: any;
|
||||
>dec : Symbol(dec, Decl(index.ts, 44, 13))
|
||||
|
||||
@(await dec)
|
||||
>dec : Symbol(dec, Decl(index.ts, 44, 13))
|
||||
|
||||
class C {
|
||||
>C : Symbol(C, Decl(index.ts, 44, 23))
|
||||
}
|
||||
|
||||
// await allowed in aliased import
|
||||
import { await as _await } from "./other";
|
||||
>await : Symbol(await, Decl(other.ts, 3, 8))
|
||||
>_await : Symbol(_await, Decl(index.ts, 50, 8))
|
||||
|
||||
// newlines
|
||||
// await in throw
|
||||
throw await
|
||||
1;
|
||||
|
||||
// await in var
|
||||
let y = await
|
||||
>y : Symbol(y, Decl(index.ts, 58, 3))
|
||||
|
||||
1;
|
||||
|
||||
// await in expression statement;
|
||||
await
|
||||
1;
|
||||
|
||||
=== tests/cases/conformance/externalModules/other.ts ===
|
||||
const _await = 1;
|
||||
>_await : Symbol(_await, Decl(other.ts, 0, 5))
|
||||
|
||||
// await allowed in aliased export
|
||||
export { _await as await };
|
||||
>_await : Symbol(_await, Decl(other.ts, 0, 5))
|
||||
>await : Symbol(await, Decl(other.ts, 3, 8))
|
||||
|
||||
// for-await-of
|
||||
const arr = [Promise.resolve()];
|
||||
>arr : Symbol(arr, Decl(other.ts, 6, 5))
|
||||
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
|
||||
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
|
||||
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
|
||||
|
||||
for await (const item of arr) {
|
||||
>item : Symbol(item, Decl(other.ts, 8, 16))
|
||||
>arr : Symbol(arr, Decl(other.ts, 6, 5))
|
||||
|
||||
item;
|
||||
>item : Symbol(item, Decl(other.ts, 8, 16))
|
||||
}
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
=== tests/cases/conformance/externalModules/index.ts ===
|
||||
export const x = 1;
|
||||
>x : 1
|
||||
>1 : 1
|
||||
|
||||
await x;
|
||||
>await x : 1
|
||||
>x : 1
|
||||
|
||||
// reparse element access as await
|
||||
await [x];
|
||||
>await [x] : number[]
|
||||
>[x] : number[]
|
||||
>x : 1
|
||||
|
||||
await [x, x];
|
||||
>await [x, x] : number[]
|
||||
>[x, x] : number[]
|
||||
>x : 1
|
||||
>x : 1
|
||||
|
||||
// reparse call as await
|
||||
declare function f(): number;
|
||||
>f : () => number
|
||||
|
||||
await (x);
|
||||
>await (x) : 1
|
||||
>(x) : 1
|
||||
>x : 1
|
||||
|
||||
await (f(), x);
|
||||
>await (f(), x) : 1
|
||||
>(f(), x) : 1
|
||||
>f(), x : 1
|
||||
>f() : number
|
||||
>f : () => number
|
||||
>x : 1
|
||||
|
||||
await <number>(x);
|
||||
>await <number>(x) : number
|
||||
><number>(x) : number
|
||||
>(x) : 1
|
||||
>x : 1
|
||||
|
||||
await <number>(f(), x);
|
||||
>await <number>(f(), x) : number
|
||||
><number>(f(), x) : number
|
||||
>(f(), x) : 1
|
||||
>f(), x : 1
|
||||
>f() : number
|
||||
>f : () => number
|
||||
>x : 1
|
||||
|
||||
// reparse tagged template as await
|
||||
await ``;
|
||||
>await `` : ""
|
||||
>`` : ""
|
||||
|
||||
await <string> ``;
|
||||
>await <string> `` : string
|
||||
><string> `` : string
|
||||
>`` : ""
|
||||
|
||||
// member names should be ok
|
||||
class C1 {
|
||||
>C1 : C1
|
||||
|
||||
await() {}
|
||||
>await : () => void
|
||||
}
|
||||
class C2 {
|
||||
>C2 : C2
|
||||
|
||||
get await() { return 1; }
|
||||
>await : number
|
||||
>1 : 1
|
||||
|
||||
set await(value) { }
|
||||
>await : number
|
||||
>value : number
|
||||
}
|
||||
class C3 {
|
||||
>C3 : C3
|
||||
|
||||
await = 1;
|
||||
>await : number
|
||||
>1 : 1
|
||||
}
|
||||
({
|
||||
>({ await() {}}) : { await(): void; }
|
||||
>{ await() {}} : { await(): void; }
|
||||
|
||||
await() {}
|
||||
>await : () => void
|
||||
|
||||
});
|
||||
({
|
||||
>({ get await() { return 1 }, set await(value) { }}) : { await: number; }
|
||||
>{ get await() { return 1 }, set await(value) { }} : { await: number; }
|
||||
|
||||
get await() { return 1 },
|
||||
>await : number
|
||||
>1 : 1
|
||||
|
||||
set await(value) { }
|
||||
>await : number
|
||||
>value : number
|
||||
|
||||
});
|
||||
({
|
||||
>({ await: 1}) : { await: number; }
|
||||
>{ await: 1} : { await: number; }
|
||||
|
||||
await: 1
|
||||
>await : number
|
||||
>1 : 1
|
||||
|
||||
});
|
||||
|
||||
// property access name should be ok
|
||||
C1.prototype.await;
|
||||
>C1.prototype.await : () => void
|
||||
>C1.prototype : C1
|
||||
>C1 : typeof C1
|
||||
>prototype : C1
|
||||
>await : () => void
|
||||
|
||||
// await in decorators
|
||||
declare const dec: any;
|
||||
>dec : any
|
||||
|
||||
@(await dec)
|
||||
>(await dec) : any
|
||||
>await dec : any
|
||||
>dec : any
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
}
|
||||
|
||||
// await allowed in aliased import
|
||||
import { await as _await } from "./other";
|
||||
>await : 1
|
||||
>_await : 1
|
||||
|
||||
// newlines
|
||||
// await in throw
|
||||
throw await
|
||||
>await 1 : 1
|
||||
|
||||
1;
|
||||
>1 : 1
|
||||
|
||||
// await in var
|
||||
let y = await
|
||||
>y : number
|
||||
>await 1 : 1
|
||||
|
||||
1;
|
||||
>1 : 1
|
||||
|
||||
// await in expression statement;
|
||||
await
|
||||
>await 1 : 1
|
||||
|
||||
1;
|
||||
>1 : 1
|
||||
|
||||
=== tests/cases/conformance/externalModules/other.ts ===
|
||||
const _await = 1;
|
||||
>_await : 1
|
||||
>1 : 1
|
||||
|
||||
// await allowed in aliased export
|
||||
export { _await as await };
|
||||
>_await : 1
|
||||
>await : 1
|
||||
|
||||
// for-await-of
|
||||
const arr = [Promise.resolve()];
|
||||
>arr : Promise<void>[]
|
||||
>[Promise.resolve()] : Promise<void>[]
|
||||
>Promise.resolve() : Promise<void>
|
||||
>Promise.resolve : { (): Promise<void>; <T>(value: T | PromiseLike<T>): Promise<T>; }
|
||||
>Promise : PromiseConstructor
|
||||
>resolve : { (): Promise<void>; <T>(value: T | PromiseLike<T>): Promise<T>; }
|
||||
|
||||
for await (const item of arr) {
|
||||
>item : void
|
||||
>arr : Promise<void>[]
|
||||
|
||||
item;
|
||||
>item : void
|
||||
}
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
tests/cases/conformance/externalModules/index.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/externalModules/index.ts(46,3): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/externalModules/index.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/externalModules/index.ts(46,3): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/index.ts (2 errors) ====
|
||||
export const x = 1;
|
||||
await x;
|
||||
~~~~~
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
|
||||
// reparse element access as await
|
||||
await [x];
|
||||
|
@ -53,7 +53,7 @@ tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level '
|
|||
declare const dec: any;
|
||||
@(await dec)
|
||||
~~~~~
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
class C {
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level '
|
|||
|
||||
for await (const item of arr) {
|
||||
~~~~~
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
item;
|
||||
}
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
tests/cases/conformance/externalModules/index.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/externalModules/index.ts(46,3): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/externalModules/index.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/externalModules/index.ts(46,3): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/index.ts (2 errors) ====
|
||||
export const x = 1;
|
||||
await x;
|
||||
~~~~~
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
|
||||
// reparse element access as await
|
||||
await [x];
|
||||
|
@ -53,7 +53,7 @@ tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level '
|
|||
declare const dec: any;
|
||||
@(await dec)
|
||||
~~~~~
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
class C {
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level '
|
|||
|
||||
for await (const item of arr) {
|
||||
~~~~~
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
|
||||
item;
|
||||
}
|
||||
|
10
tests/baselines/reference/topLevelAwait.2(module=esnext).js
Normal file
10
tests/baselines/reference/topLevelAwait.2(module=esnext).js
Normal file
|
@ -0,0 +1,10 @@
|
|||
//// [topLevelAwait.2.ts]
|
||||
declare namespace foo { const await: any; }
|
||||
|
||||
// await allowed in import=namespace when not a module
|
||||
import await = foo.await;
|
||||
|
||||
|
||||
//// [topLevelAwait.2.js]
|
||||
// await allowed in import=namespace when not a module
|
||||
var await = foo.await;
|
|
@ -0,0 +1,11 @@
|
|||
=== tests/cases/conformance/externalModules/topLevelAwait.2.ts ===
|
||||
declare namespace foo { const await: any; }
|
||||
>foo : Symbol(foo, Decl(topLevelAwait.2.ts, 0, 0))
|
||||
>await : Symbol(await, Decl(topLevelAwait.2.ts, 0, 29))
|
||||
|
||||
// await allowed in import=namespace when not a module
|
||||
import await = foo.await;
|
||||
>await : Symbol(await, Decl(topLevelAwait.2.ts, 0, 43))
|
||||
>foo : Symbol(foo, Decl(topLevelAwait.2.ts, 0, 0))
|
||||
>await : Symbol(await, Decl(topLevelAwait.2.ts, 0, 29))
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
=== tests/cases/conformance/externalModules/topLevelAwait.2.ts ===
|
||||
declare namespace foo { const await: any; }
|
||||
>foo : typeof foo
|
||||
>await : any
|
||||
|
||||
// await allowed in import=namespace when not a module
|
||||
import await = foo.await;
|
||||
>await : any
|
||||
>foo : typeof foo
|
||||
>await : any
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
=== tests/cases/conformance/externalModules/index.d.ts ===
|
||||
// await keyword allowed as identifier in a declaration file
|
||||
export {};
|
||||
declare const await: any;
|
||||
>await : Symbol(await, Decl(index.d.ts, 2, 13))
|
||||
|
||||
declare class C extends await {}
|
||||
>C : Symbol(C, Decl(index.d.ts, 2, 25))
|
||||
>await : Symbol(await, Decl(index.d.ts, 2, 13))
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
=== tests/cases/conformance/externalModules/index.d.ts ===
|
||||
// await keyword allowed as identifier in a declaration file
|
||||
export {};
|
||||
declare const await: any;
|
||||
>await : any
|
||||
|
||||
declare class C extends await {}
|
||||
>C : C
|
||||
>await : any
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(4,8): error TS2695: Left side of comma operator is unused and has no side effects.
|
||||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(4,10): error TS1109: Expression expected.
|
||||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(5,14): error TS1005: '>' expected.
|
||||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(5,16): error TS2693: 'string' only refers to a type, but is being used as a value here.
|
||||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(8,14): error TS1005: '>' expected.
|
||||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(8,16): error TS2693: 'string' only refers to a type, but is being used as a value here.
|
||||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(11,17): error TS1109: Expression expected.
|
||||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(11,22): error TS1109: Expression expected.
|
||||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(11,23): error TS2693: 'string' only refers to a type, but is being used as a value here.
|
||||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(11,29): error TS1005: ',' expected.
|
||||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(15,8): error TS1109: Expression expected.
|
||||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(18,2): error TS1109: Expression expected.
|
||||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(18,8): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(21,2): error TS1109: Expression expected.
|
||||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(26,6): error TS1109: Expression expected.
|
||||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(30,6): error TS1109: Expression expected.
|
||||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(34,12): error TS1109: Expression expected.
|
||||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(40,14): error TS1109: Expression expected.
|
||||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(41,14): error TS1109: Expression expected.
|
||||
tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts(42,20): error TS1109: Expression expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts (20 errors) ====
|
||||
export {};
|
||||
|
||||
// reparse call as invalid await should error
|
||||
await (1,);
|
||||
~
|
||||
!!! error TS2695: Left side of comma operator is unused and has no side effects.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
await <number, string>(1);
|
||||
~
|
||||
!!! error TS1005: '>' expected.
|
||||
~~~~~~
|
||||
!!! error TS2693: 'string' only refers to a type, but is being used as a value here.
|
||||
|
||||
// reparse tagged template as invalid await should error
|
||||
await <number, string> ``;
|
||||
~
|
||||
!!! error TS1005: '>' expected.
|
||||
~~~~~~
|
||||
!!! error TS2693: 'string' only refers to a type, but is being used as a value here.
|
||||
|
||||
// reparse class extends clause should fail
|
||||
class C extends await<string> {
|
||||
~~~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~~~~
|
||||
!!! error TS2693: 'string' only refers to a type, but is being used as a value here.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
}
|
||||
|
||||
// await in class decorators should fail
|
||||
@(await)
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
class C1 {}
|
||||
|
||||
@await(x)
|
||||
~~~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'x'.
|
||||
class C2 {}
|
||||
|
||||
@await
|
||||
~~~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
class C3 {}
|
||||
|
||||
// await in member decorators should fail
|
||||
class C4 {
|
||||
@await
|
||||
~~~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
["foo"]() {}
|
||||
}
|
||||
class C5 {
|
||||
@await(1)
|
||||
~~~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
["foo"]() {}
|
||||
}
|
||||
class C6 {
|
||||
@(await)
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
["foo"]() {}
|
||||
}
|
||||
|
||||
// await in parameter decorators should fail
|
||||
class C7 {
|
||||
method1(@await [x]) {}
|
||||
~~~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
method2(@await(1) [x]) {}
|
||||
~~~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
method3(@(await) [x]) {}
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
//// [topLevelAwaitErrors.1.ts]
|
||||
export {};
|
||||
|
||||
// reparse call as invalid await should error
|
||||
await (1,);
|
||||
await <number, string>(1);
|
||||
|
||||
// reparse tagged template as invalid await should error
|
||||
await <number, string> ``;
|
||||
|
||||
// reparse class extends clause should fail
|
||||
class C extends await<string> {
|
||||
}
|
||||
|
||||
// await in class decorators should fail
|
||||
@(await)
|
||||
class C1 {}
|
||||
|
||||
@await(x)
|
||||
class C2 {}
|
||||
|
||||
@await
|
||||
class C3 {}
|
||||
|
||||
// await in member decorators should fail
|
||||
class C4 {
|
||||
@await
|
||||
["foo"]() {}
|
||||
}
|
||||
class C5 {
|
||||
@await(1)
|
||||
["foo"]() {}
|
||||
}
|
||||
class C6 {
|
||||
@(await)
|
||||
["foo"]() {}
|
||||
}
|
||||
|
||||
// await in parameter decorators should fail
|
||||
class C7 {
|
||||
method1(@await [x]) {}
|
||||
method2(@await(1) [x]) {}
|
||||
method3(@(await) [x]) {}
|
||||
}
|
||||
|
||||
|
||||
//// [topLevelAwaitErrors.1.js]
|
||||
// reparse call as invalid await should error
|
||||
await (1, );
|
||||
await , string > (1);
|
||||
// reparse tagged template as invalid await should error
|
||||
await , string > ``;
|
||||
// reparse class extends clause should fail
|
||||
class C extends string {
|
||||
}
|
||||
// await in class decorators should fail
|
||||
let C1 = class C1 {
|
||||
};
|
||||
C1 = __decorate([
|
||||
(await )
|
||||
], C1);
|
||||
let C2 = class C2 {
|
||||
};
|
||||
C2 = __decorate([
|
||||
(x)
|
||||
], C2);
|
||||
let C3 = class C3 {
|
||||
};
|
||||
C3 = __decorate([
|
||||
], C3);
|
||||
// await in member decorators should fail
|
||||
class C4 {
|
||||
["foo"]() { }
|
||||
}
|
||||
__decorate([
|
||||
], C4.prototype, "foo", null);
|
||||
class C5 {
|
||||
["foo"]() { }
|
||||
}
|
||||
__decorate([
|
||||
(1)
|
||||
], C5.prototype, "foo", null);
|
||||
class C6 {
|
||||
["foo"]() { }
|
||||
}
|
||||
__decorate([
|
||||
(await )
|
||||
], C6.prototype, "foo", null);
|
||||
// await in parameter decorators should fail
|
||||
class C7 {
|
||||
method1([x]) { }
|
||||
method2([x]) { }
|
||||
method3([x]) { }
|
||||
}
|
||||
__decorate([
|
||||
__param(0, )
|
||||
], C7.prototype, "method1", null);
|
||||
__decorate([
|
||||
__param(0, (1))
|
||||
], C7.prototype, "method2", null);
|
||||
__decorate([
|
||||
__param(0, (await ))
|
||||
], C7.prototype, "method3", null);
|
||||
export {};
|
|
@ -0,0 +1,71 @@
|
|||
=== tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts ===
|
||||
export {};
|
||||
|
||||
// reparse call as invalid await should error
|
||||
await (1,);
|
||||
await <number, string>(1);
|
||||
|
||||
// reparse tagged template as invalid await should error
|
||||
await <number, string> ``;
|
||||
|
||||
// reparse class extends clause should fail
|
||||
class C extends await<string> {
|
||||
>C : Symbol(C, Decl(topLevelAwaitErrors.1.ts, 7, 26))
|
||||
}
|
||||
|
||||
// await in class decorators should fail
|
||||
@(await)
|
||||
class C1 {}
|
||||
>C1 : Symbol(C1, Decl(topLevelAwaitErrors.1.ts, 11, 1))
|
||||
|
||||
@await(x)
|
||||
class C2 {}
|
||||
>C2 : Symbol(C2, Decl(topLevelAwaitErrors.1.ts, 15, 11))
|
||||
|
||||
@await
|
||||
class C3 {}
|
||||
>C3 : Symbol(C3, Decl(topLevelAwaitErrors.1.ts, 18, 11))
|
||||
|
||||
// await in member decorators should fail
|
||||
class C4 {
|
||||
>C4 : Symbol(C4, Decl(topLevelAwaitErrors.1.ts, 21, 11))
|
||||
|
||||
@await
|
||||
["foo"]() {}
|
||||
>["foo"] : Symbol(C4["foo"], Decl(topLevelAwaitErrors.1.ts, 24, 10))
|
||||
>"foo" : Symbol(C4["foo"], Decl(topLevelAwaitErrors.1.ts, 24, 10))
|
||||
}
|
||||
class C5 {
|
||||
>C5 : Symbol(C5, Decl(topLevelAwaitErrors.1.ts, 27, 1))
|
||||
|
||||
@await(1)
|
||||
["foo"]() {}
|
||||
>["foo"] : Symbol(C5["foo"], Decl(topLevelAwaitErrors.1.ts, 28, 10))
|
||||
>"foo" : Symbol(C5["foo"], Decl(topLevelAwaitErrors.1.ts, 28, 10))
|
||||
}
|
||||
class C6 {
|
||||
>C6 : Symbol(C6, Decl(topLevelAwaitErrors.1.ts, 31, 1))
|
||||
|
||||
@(await)
|
||||
["foo"]() {}
|
||||
>["foo"] : Symbol(C6["foo"], Decl(topLevelAwaitErrors.1.ts, 32, 10))
|
||||
>"foo" : Symbol(C6["foo"], Decl(topLevelAwaitErrors.1.ts, 32, 10))
|
||||
}
|
||||
|
||||
// await in parameter decorators should fail
|
||||
class C7 {
|
||||
>C7 : Symbol(C7, Decl(topLevelAwaitErrors.1.ts, 35, 1))
|
||||
|
||||
method1(@await [x]) {}
|
||||
>method1 : Symbol(C7.method1, Decl(topLevelAwaitErrors.1.ts, 38, 10))
|
||||
>x : Symbol(x, Decl(topLevelAwaitErrors.1.ts, 39, 20))
|
||||
|
||||
method2(@await(1) [x]) {}
|
||||
>method2 : Symbol(C7.method2, Decl(topLevelAwaitErrors.1.ts, 39, 26))
|
||||
>x : Symbol(x, Decl(topLevelAwaitErrors.1.ts, 40, 23))
|
||||
|
||||
method3(@(await) [x]) {}
|
||||
>method3 : Symbol(C7.method3, Decl(topLevelAwaitErrors.1.ts, 40, 29))
|
||||
>x : Symbol(x, Decl(topLevelAwaitErrors.1.ts, 41, 22))
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
=== tests/cases/conformance/externalModules/topLevelAwaitErrors.1.ts ===
|
||||
export {};
|
||||
|
||||
// reparse call as invalid await should error
|
||||
await (1,);
|
||||
>await (1,) : any
|
||||
>(1,) : any
|
||||
>1, : any
|
||||
>1 : 1
|
||||
> : any
|
||||
|
||||
await <number, string>(1);
|
||||
>await <number, string>(1) : boolean
|
||||
>await <number : number
|
||||
><number : number
|
||||
> : any
|
||||
>string>(1) : boolean
|
||||
>string : any
|
||||
>(1) : 1
|
||||
>1 : 1
|
||||
|
||||
// reparse tagged template as invalid await should error
|
||||
await <number, string> ``;
|
||||
>await <number, string> `` : boolean
|
||||
>await <number : number
|
||||
><number : number
|
||||
> : any
|
||||
>string> `` : boolean
|
||||
>string : any
|
||||
>`` : ""
|
||||
|
||||
// reparse class extends clause should fail
|
||||
class C extends await<string> {
|
||||
>C : C
|
||||
>string : any
|
||||
}
|
||||
|
||||
// await in class decorators should fail
|
||||
@(await)
|
||||
>(await) : any
|
||||
>await : any
|
||||
> : any
|
||||
|
||||
class C1 {}
|
||||
>C1 : C1
|
||||
|
||||
@await(x)
|
||||
>await(x) : any
|
||||
> : any
|
||||
>x : any
|
||||
|
||||
class C2 {}
|
||||
>C2 : C2
|
||||
|
||||
@await
|
||||
> : any
|
||||
|
||||
class C3 {}
|
||||
>C3 : C3
|
||||
|
||||
// await in member decorators should fail
|
||||
class C4 {
|
||||
>C4 : C4
|
||||
|
||||
@await
|
||||
> : any
|
||||
|
||||
["foo"]() {}
|
||||
>["foo"] : () => void
|
||||
>"foo" : "foo"
|
||||
}
|
||||
class C5 {
|
||||
>C5 : C5
|
||||
|
||||
@await(1)
|
||||
>await(1) : any
|
||||
> : any
|
||||
>1 : 1
|
||||
|
||||
["foo"]() {}
|
||||
>["foo"] : () => void
|
||||
>"foo" : "foo"
|
||||
}
|
||||
class C6 {
|
||||
>C6 : C6
|
||||
|
||||
@(await)
|
||||
>(await) : any
|
||||
>await : any
|
||||
> : any
|
||||
|
||||
["foo"]() {}
|
||||
>["foo"] : () => void
|
||||
>"foo" : "foo"
|
||||
}
|
||||
|
||||
// await in parameter decorators should fail
|
||||
class C7 {
|
||||
>C7 : C7
|
||||
|
||||
method1(@await [x]) {}
|
||||
>method1 : ([x]: [any]) => void
|
||||
> : any
|
||||
>x : any
|
||||
|
||||
method2(@await(1) [x]) {}
|
||||
>method2 : ([x]: [any]) => void
|
||||
>await(1) : any
|
||||
> : any
|
||||
>1 : 1
|
||||
>x : any
|
||||
|
||||
method3(@(await) [x]) {}
|
||||
>method3 : ([x]: [any]) => void
|
||||
>(await) : any
|
||||
>await : any
|
||||
> : any
|
||||
>x : any
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
tests/cases/conformance/externalModules/index.ts(2,19): error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/index.ts (1 errors) ====
|
||||
// await disallowed in alias of named import
|
||||
import { await as await } from "./other";
|
||||
~~~~~
|
||||
!!! error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
|
||||
|
||||
==== tests/cases/conformance/externalModules/other.ts (0 errors) ====
|
||||
declare const _await: any;
|
||||
export { _await as await };
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
//// [tests/cases/conformance/externalModules/topLevelAwaitErrors.10.ts] ////
|
||||
|
||||
//// [index.ts]
|
||||
// await disallowed in alias of named import
|
||||
import { await as await } from "./other";
|
||||
|
||||
//// [other.ts]
|
||||
declare const _await: any;
|
||||
export { _await as await };
|
||||
|
||||
|
||||
//// [other.js]
|
||||
export { _await as await };
|
||||
//// [index.js]
|
||||
export {};
|
|
@ -0,0 +1,14 @@
|
|||
=== tests/cases/conformance/externalModules/index.ts ===
|
||||
// await disallowed in alias of named import
|
||||
import { await as await } from "./other";
|
||||
>await : Symbol(await, Decl(other.ts, 1, 8))
|
||||
>await : Symbol(await, Decl(index.ts, 1, 8))
|
||||
|
||||
=== tests/cases/conformance/externalModules/other.ts ===
|
||||
declare const _await: any;
|
||||
>_await : Symbol(_await, Decl(other.ts, 0, 13))
|
||||
|
||||
export { _await as await };
|
||||
>_await : Symbol(_await, Decl(other.ts, 0, 13))
|
||||
>await : Symbol(await, Decl(other.ts, 1, 8))
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
=== tests/cases/conformance/externalModules/index.ts ===
|
||||
// await disallowed in alias of named import
|
||||
import { await as await } from "./other";
|
||||
>await : any
|
||||
>await : any
|
||||
|
||||
=== tests/cases/conformance/externalModules/other.ts ===
|
||||
declare const _await: any;
|
||||
>_await : any
|
||||
|
||||
export { _await as await };
|
||||
>_await : any
|
||||
>await : any
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
tests/cases/conformance/externalModules/topLevelAwaitErrors.12.ts(5,8): error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/topLevelAwaitErrors.12.ts (1 errors) ====
|
||||
export {};
|
||||
declare namespace foo { const await: any; }
|
||||
|
||||
// await disallowed in import=namespace when in a module
|
||||
import await = foo.await;
|
||||
~~~~~
|
||||
!!! error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
//// [topLevelAwaitErrors.12.ts]
|
||||
export {};
|
||||
declare namespace foo { const await: any; }
|
||||
|
||||
// await disallowed in import=namespace when in a module
|
||||
import await = foo.await;
|
||||
|
||||
|
||||
//// [topLevelAwaitErrors.12.js]
|
||||
export {};
|
|
@ -0,0 +1,12 @@
|
|||
=== tests/cases/conformance/externalModules/topLevelAwaitErrors.12.ts ===
|
||||
export {};
|
||||
declare namespace foo { const await: any; }
|
||||
>foo : Symbol(foo, Decl(topLevelAwaitErrors.12.ts, 0, 10))
|
||||
>await : Symbol(await, Decl(topLevelAwaitErrors.12.ts, 1, 29))
|
||||
|
||||
// await disallowed in import=namespace when in a module
|
||||
import await = foo.await;
|
||||
>await : Symbol(await, Decl(topLevelAwaitErrors.12.ts, 1, 43))
|
||||
>foo : Symbol(foo, Decl(topLevelAwaitErrors.12.ts, 0, 10))
|
||||
>await : Symbol(await, Decl(topLevelAwaitErrors.12.ts, 1, 29))
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
=== tests/cases/conformance/externalModules/topLevelAwaitErrors.12.ts ===
|
||||
export {};
|
||||
declare namespace foo { const await: any; }
|
||||
>foo : typeof foo
|
||||
>await : any
|
||||
|
||||
// await disallowed in import=namespace when in a module
|
||||
import await = foo.await;
|
||||
>await : any
|
||||
>foo : typeof foo
|
||||
>await : any
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
tests/cases/conformance/externalModules/topLevelAwaitErrors.2.ts(4,5): error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/topLevelAwaitErrors.2.ts (1 errors) ====
|
||||
export {};
|
||||
|
||||
// reparse variable name as await should fail
|
||||
var await = 1;
|
||||
~~~~~
|
||||
!!! error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
//// [topLevelAwaitErrors.2.ts]
|
||||
export {};
|
||||
|
||||
// reparse variable name as await should fail
|
||||
var await = 1;
|
||||
|
||||
|
||||
//// [topLevelAwaitErrors.2.js]
|
||||
// reparse variable name as await should fail
|
||||
var await = 1;
|
||||
export {};
|
|
@ -0,0 +1,7 @@
|
|||
=== tests/cases/conformance/externalModules/topLevelAwaitErrors.2.ts ===
|
||||
export {};
|
||||
|
||||
// reparse variable name as await should fail
|
||||
var await = 1;
|
||||
>await : Symbol(await, Decl(topLevelAwaitErrors.2.ts, 3, 3))
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
=== tests/cases/conformance/externalModules/topLevelAwaitErrors.2.ts ===
|
||||
export {};
|
||||
|
||||
// reparse variable name as await should fail
|
||||
var await = 1;
|
||||
>await : number
|
||||
>1 : 1
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
tests/cases/conformance/externalModules/topLevelAwaitErrors.3.ts(4,6): error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
|
||||
|
||||
|
||||
==== tests/cases/conformance/externalModules/topLevelAwaitErrors.3.ts (1 errors) ====
|
||||
export {};
|
||||
|
||||
// reparse binding pattern as await should fail
|
||||
var {await} = {await:1};
|
||||
~~~~~
|
||||
!!! error TS1262: Identifier expected. 'await' is a reserved word at the top-level of a module.
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
//// [topLevelAwaitErrors.3.ts]
|
||||
export {};
|
||||
|
||||
// reparse binding pattern as await should fail
|
||||
var {await} = {await:1};
|
||||
|
||||
|
||||
//// [topLevelAwaitErrors.3.js]
|
||||
// reparse binding pattern as await should fail
|
||||
var { await } = { await: 1 };
|
||||
export {};
|
|
@ -0,0 +1,8 @@
|
|||
=== tests/cases/conformance/externalModules/topLevelAwaitErrors.3.ts ===
|
||||
export {};
|
||||
|
||||
// reparse binding pattern as await should fail
|
||||
var {await} = {await:1};
|
||||
>await : Symbol(await, Decl(topLevelAwaitErrors.3.ts, 3, 5))
|
||||
>await : Symbol(await, Decl(topLevelAwaitErrors.3.ts, 3, 15))
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
=== tests/cases/conformance/externalModules/topLevelAwaitErrors.3.ts ===
|
||||
export {};
|
||||
|
||||
// reparse binding pattern as await should fail
|
||||
var {await} = {await:1};
|
||||
>await : number
|
||||
>{await:1} : { await: number; }
|
||||
>await : number
|
||||
>1 : 1
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue