Merge branch 'main' into packageJsonWatch

This commit is contained in:
Sheetal Nandi
2022-05-05 10:18:14 -07:00
465 changed files with 22486 additions and 1927 deletions
+1
View File
@@ -169,6 +169,7 @@ TypeScript is authored by:
- Gabriel Isenberg
- Gabriela Araujo Britto
- Gabriela Britto
- Gao Sheng
- gb714us
- Gilad Peleg
- Godfrey Chan
+34 -40
View File
@@ -638,9 +638,9 @@
"dev": true
},
"@types/node": {
"version": "17.0.29",
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.29.tgz",
"integrity": "sha512-tx5jMmMFwx7wBwq/V7OohKDVb/JwJU5qCVkeLMh1//xycAJ/ESuw9aJ9SEtlCZDYi2pBfe4JkisSoAtbOsBNAA==",
"version": "17.0.31",
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.31.tgz",
"integrity": "sha512-AR0x5HbXGqkEx9CadRH3EBYx/VkiUgZIhP4wvPn/+5KIsgpNoyFaRlVe0Zlx9gRtg8fA06a9tskE2MSN7TcG4Q==",
"dev": true
},
"@types/node-fetch": {
@@ -3334,12 +3334,6 @@
"integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
"dev": true
},
"growl": {
"version": "1.10.5",
"resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz",
"integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==",
"dev": true
},
"gulp": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/gulp/-/gulp-4.0.2.tgz",
@@ -4328,32 +4322,30 @@
"dev": true
},
"mocha": {
"version": "9.2.2",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-9.2.2.tgz",
"integrity": "sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g==",
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-10.0.0.tgz",
"integrity": "sha512-0Wl+elVUD43Y0BqPZBzZt8Tnkw9CMUdNYnUsTfOM1vuhJVZL+kiesFYsqwBkEEuEixaiPe5ZQdqDgX2jddhmoA==",
"dev": true,
"requires": {
"@ungap/promise-all-settled": "1.1.2",
"ansi-colors": "4.1.1",
"browser-stdout": "1.3.1",
"chokidar": "3.5.3",
"debug": "4.3.3",
"debug": "4.3.4",
"diff": "5.0.0",
"escape-string-regexp": "4.0.0",
"find-up": "5.0.0",
"glob": "7.2.0",
"growl": "1.10.5",
"he": "1.2.0",
"js-yaml": "4.1.0",
"log-symbols": "4.1.0",
"minimatch": "4.2.1",
"minimatch": "5.0.1",
"ms": "2.1.3",
"nanoid": "3.3.1",
"nanoid": "3.3.3",
"serialize-javascript": "6.0.0",
"strip-json-comments": "3.1.1",
"supports-color": "8.1.1",
"which": "2.0.2",
"workerpool": "6.2.0",
"workerpool": "6.2.1",
"yargs": "16.2.0",
"yargs-parser": "20.2.4",
"yargs-unparser": "2.0.0"
@@ -4430,9 +4422,9 @@
}
},
"debug": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz",
"integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==",
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"dev": true,
"requires": {
"ms": "2.1.2"
@@ -4570,12 +4562,23 @@
}
},
"minimatch": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz",
"integrity": "sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g==",
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz",
"integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
"brace-expansion": "^2.0.1"
},
"dependencies": {
"brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0"
}
}
}
},
"p-limit": {
@@ -4651,15 +4654,6 @@
"is-number": "^7.0.0"
}
},
"which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
"requires": {
"isexe": "^2.0.0"
}
},
"wrap-ansi": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
@@ -4726,9 +4720,9 @@
"optional": true
},
"nanoid": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz",
"integrity": "sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==",
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz",
"integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==",
"dev": true
},
"nanomatch": {
@@ -6685,9 +6679,9 @@
"dev": true
},
"workerpool": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz",
"integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==",
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz",
"integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==",
"dev": true
},
"wrap-ansi": {
+3 -1
View File
@@ -122,7 +122,9 @@ async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode,
try {
setNodeEnvToDevelopment();
const { exitCode } = await exec("node", args, { cancelToken });
const { exitCode } = await exec(process.execPath, args, {
cancelToken,
});
if (exitCode !== 0) {
errorStatus = exitCode;
error = new Error(`Process exited with status code ${errorStatus}.`);
+79 -40
View File
@@ -1048,7 +1048,7 @@ namespace ts {
const builtinGlobals = createSymbolTable();
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
// Extensions suggested for path imports when module resolution is node12 or higher.
// Extensions suggested for path imports when module resolution is node16 or higher.
// The first element of each tuple is the extension a file has.
// The second element of each tuple is the extension that should be used in a path import.
// e.g. if we want to import file `foo.mts`, we should write `import {} from "./foo.mjs".
@@ -3528,7 +3528,7 @@ namespace ts {
if (resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
}
if (getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Node12 || getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.NodeNext) {
if (getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Node16 || getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.NodeNext) {
const isSyncImport = (currentSourceFile.impliedNodeFormat === ModuleKind.CommonJS && !findAncestor(location, isImportCall)) || !!findAncestor(location, isImportEqualsDeclaration);
const overrideClauseHost = findAncestor(location, l => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l)) as ImportTypeNode | ImportDeclaration | ExportDeclaration | undefined;
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? overrideClauseHost.assertions?.assertClause : overrideClauseHost?.assertClause;
@@ -3537,9 +3537,6 @@ namespace ts {
if (isSyncImport && sourceFile.impliedNodeFormat === ModuleKind.ESNext && !getResolutionModeOverrideForClause(overrideClause)) {
error(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference);
}
if (mode === ModuleKind.ESNext && compilerOptions.resolveJsonModule && resolvedModule.extension === Extension.Json) {
error(errorNode, Diagnostics.JSON_imports_are_experimental_in_ES_module_mode_imports);
}
}
// merged symbol is module declaration symbol combined with all augmentations
return getMergedSymbol(sourceFile.symbol);
@@ -3596,7 +3593,7 @@ namespace ts {
const tsExtension = tryExtractTSExtension(moduleReference);
const isExtensionlessRelativePathImport = pathIsRelative(moduleReference) && !hasExtension(moduleReference);
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
const resolutionIsNode12OrNext = moduleResolutionKind === ModuleResolutionKind.Node12 ||
const resolutionIsNode16OrNext = moduleResolutionKind === ModuleResolutionKind.Node16 ||
moduleResolutionKind === ModuleResolutionKind.NodeNext;
if (tsExtension) {
const diag = Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
@@ -3617,16 +3614,16 @@ namespace ts {
hasJsonModuleEmitEnabled(compilerOptions)) {
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
}
else if (mode === ModuleKind.ESNext && resolutionIsNode12OrNext && isExtensionlessRelativePathImport) {
else if (mode === ModuleKind.ESNext && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
const suggestedExt = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))?.[1];
if (suggestedExt) {
error(errorNode,
Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0,
Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0,
moduleReference + suggestedExt);
}
else {
error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path);
error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
}
}
else {
@@ -6191,7 +6188,7 @@ namespace ts {
const targetFile = getSourceFileOfModule(chain[0]);
let specifier: string | undefined;
let assertion: ImportTypeAssertionContainer | undefined;
if (getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Node12 || getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.NodeNext) {
if (getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Node16 || getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.NodeNext) {
// An `import` type directed at an esm format file is only going to resolve in esm mode - set the esm mode assertion
if (targetFile?.impliedNodeFormat === ModuleKind.ESNext && targetFile.impliedNodeFormat !== contextFile?.impliedNodeFormat) {
specifier = getSpecifierForModuleSymbol(chain[0], context, ModuleKind.ESNext);
@@ -6208,7 +6205,7 @@ namespace ts {
}
if (!(context.flags & NodeBuilderFlags.AllowNodeModulesRelativePaths) && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Classic && specifier.indexOf("/node_modules/") >= 0) {
const oldSpecifier = specifier;
if (getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Node12 || getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.NodeNext) {
if (getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Node16 || getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.NodeNext) {
// We might be able to write a portable import type using a mode override; try specifier generation again, but with a different mode set
const swappedMode = contextFile?.impliedNodeFormat === ModuleKind.ESNext ? ModuleKind.CommonJS : ModuleKind.ESNext;
specifier = getSpecifierForModuleSymbol(chain[0], context, swappedMode);
@@ -18772,9 +18769,6 @@ namespace ts {
return;
}
reportRelationError(headMessage, source, target);
if (strictNullChecks && source.flags & TypeFlags.TypeVariable && source.symbol?.declarations?.[0] && !getConstraintOfType(source as TypeVariable) && isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~TypeFlags.NonPrimitive))) {
associateRelatedInfo(createDiagnosticForNode(source.symbol.declarations[0], Diagnostics.This_type_parameter_probably_needs_an_extends_object_constraint));
}
}
function traceUnionsOrIntersectionsTooLarge(source: Type, target: Type): void {
@@ -19565,7 +19559,7 @@ namespace ts {
// IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
if (!(sourceFlags & TypeFlags.IndexedAccess && targetFlags & TypeFlags.IndexedAccess)) {
const constraint = getConstraintOfType(source as TypeVariable);
if (!strictNullChecks && (!constraint || (sourceFlags & TypeFlags.TypeParameter && constraint.flags & TypeFlags.Any))) {
if (!constraint || (sourceFlags & TypeFlags.TypeParameter && constraint.flags & TypeFlags.Any)) {
// A type variable with no constraint is not related to the non-primitive object type.
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~TypeFlags.NonPrimitive), RecursionFlags.Both)) {
resetErrorInfo(saveErrorInfo);
@@ -19573,12 +19567,12 @@ namespace ts {
}
}
// hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed
else if (constraint && (result = isRelatedTo(constraint, target, RecursionFlags.Source, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState))) {
else if (result = isRelatedTo(constraint, target, RecursionFlags.Source, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
resetErrorInfo(saveErrorInfo);
return result;
}
// slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
else if (constraint && (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, RecursionFlags.Source, reportErrors && !(targetFlags & sourceFlags & TypeFlags.TypeParameter), /*headMessage*/ undefined, intersectionState))) {
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, RecursionFlags.Source, reportErrors && !(targetFlags & sourceFlags & TypeFlags.TypeParameter), /*headMessage*/ undefined, intersectionState)) {
resetErrorInfo(saveErrorInfo);
return result;
}
@@ -25531,7 +25525,7 @@ namespace ts {
if (isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
const parent = declaration.parent.parent;
if (parent.kind === SyntaxKind.VariableDeclaration && getCombinedNodeFlags(declaration) & NodeFlags.Const || parent.kind === SyntaxKind.Parameter) {
const links = getNodeLinks(location);
const links = getNodeLinks(parent);
if (!(links.flags & NodeCheckFlags.InCheckIdentifier)) {
links.flags |= NodeCheckFlags.InCheckIdentifier;
const parentType = getTypeForBindingElementParent(parent, CheckMode.Normal);
@@ -32060,13 +32054,13 @@ namespace ts {
}
function checkImportMetaProperty(node: MetaProperty) {
if (moduleKind === ModuleKind.Node12 || moduleKind === ModuleKind.NodeNext) {
if (moduleKind === ModuleKind.Node16 || 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);
error(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext);
}
const file = getSourceFileOfNode(node);
Debug.assert(!!(file.flags & NodeFlags.PossiblyContainsImportMeta), "Containing file is missing import meta node flag.");
@@ -33096,16 +33090,37 @@ namespace ts {
if (!hasParseDiagnostics(sourceFile)) {
let span: TextSpan | undefined;
if (!isEffectiveExternalModule(sourceFile, compilerOptions)) {
if (!span) span = getSpanOfTokenAtPosition(sourceFile, node.pos);
span ??= getSpanOfTokenAtPosition(sourceFile, node.pos);
const diagnostic = createFileDiagnostic(sourceFile, span.start, span.length,
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.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_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher);
diagnostics.add(diagnostic);
switch (moduleKind) {
case ModuleKind.Node16:
case ModuleKind.NodeNext:
if (sourceFile.impliedNodeFormat === ModuleKind.CommonJS) {
span ??= getSpanOfTokenAtPosition(sourceFile, node.pos);
diagnostics.add(
createFileDiagnostic(sourceFile, span.start, span.length, Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level)
);
break;
}
// fallthrough
case ModuleKind.ES2022:
case ModuleKind.ESNext:
case ModuleKind.System:
if (languageVersion >= ScriptTarget.ES2017) {
break;
}
// fallthrough
default:
span ??= getSpanOfTokenAtPosition(sourceFile, node.pos);
diagnostics.add(
createFileDiagnostic(sourceFile, span.start, span.length,
Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher
)
);
break;
}
}
}
@@ -35809,8 +35824,8 @@ namespace ts {
if (node.assertions) {
const override = getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
if (override) {
if (getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Node12 && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.NodeNext) {
grammarErrorOnNode(node.assertions.assertClause, Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node12_or_nodenext);
if (getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Node16 && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.NodeNext) {
grammarErrorOnNode(node.assertions.assertClause, Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
}
}
}
@@ -37428,7 +37443,7 @@ namespace ts {
function checkCollisionWithRequireExportsInGeneratedCode(node: Node, name: Identifier | undefined) {
// No need to check for require or exports for ES6 modules and later
if (moduleKind >= ModuleKind.ES2015 && !(moduleKind >= ModuleKind.Node12 && getSourceFileOfNode(node).impliedNodeFormat === ModuleKind.CommonJS)) {
if (moduleKind >= ModuleKind.ES2015 && !(moduleKind >= ModuleKind.Node16 && getSourceFileOfNode(node).impliedNodeFormat === ModuleKind.CommonJS)) {
return;
}
@@ -38250,7 +38265,7 @@ namespace ts {
return (use & IterationUse.PossiblyOutOfBounds) ? includeUndefinedInIndexSignature(arrayElementType) : arrayElementType;
function getIterationDiagnosticDetails(allowsStrings: boolean, downlevelIteration: boolean | undefined): [DiagnosticMessage, boolean] {
function getIterationDiagnosticDetails(allowsStrings: boolean, downlevelIteration: boolean | undefined): [error: DiagnosticMessage, maybeMissingAwait: boolean] {
if (downlevelIteration) {
return allowsStrings
? [Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator, true]
@@ -38260,7 +38275,7 @@ namespace ts {
const yieldType = getIterationTypeOfIterable(use, IterationTypeKind.Yield, inputType, /*errorNode*/ undefined);
if (yieldType) {
return [Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators, false];
return [Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, false];
}
if (isES2015OrLaterIterable(inputType.symbol?.escapedName)) {
@@ -40703,8 +40718,8 @@ namespace ts {
const validForTypeAssertions = isExclusivelyTypeOnlyImportOrExport(declaration);
const override = getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
if (validForTypeAssertions && override) {
if (getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Node12 && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.NodeNext) {
return grammarErrorOnNode(declaration.assertClause, Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node12_or_nodenext);
if (getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Node16 && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.NodeNext) {
return grammarErrorOnNode(declaration.assertClause, Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
}
return; // Other grammar checks do not apply to type-only imports with resolution mode assertions
}
@@ -41898,7 +41913,7 @@ namespace ts {
const symbol = getIntrinsicTagSymbol(name.parent as JsxOpeningLikeElement);
return symbol === unknownSymbol ? undefined : symbol;
}
const result = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ !isJSDoc, getHostSignatureFromJSDoc(name));
const result = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /* dontResolveAlias */ true, getHostSignatureFromJSDoc(name));
if (!result && isJSDoc) {
const container = findAncestor(name, or(isClassLike, isInterfaceDeclaration));
if (container) {
@@ -43901,6 +43916,9 @@ namespace ts {
}
function checkGrammarExpressionWithTypeArguments(node: ExpressionWithTypeArguments | TypeQueryNode) {
if (isExpressionWithTypeArguments(node) && isImportKeyword(node.expression) && node.typeArguments) {
return grammarErrorOnNode(node, Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
}
return checkGrammarTypeArguments(node, node.typeArguments);
}
@@ -44173,9 +44191,30 @@ 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.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_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher));
switch (moduleKind) {
case ModuleKind.Node16:
case ModuleKind.NodeNext:
if (sourceFile.impliedNodeFormat === ModuleKind.CommonJS) {
diagnostics.add(
createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level)
);
break;
}
// fallthrough
case ModuleKind.ES2022:
case ModuleKind.ESNext:
case ModuleKind.System:
if (languageVersion >= ScriptTarget.ES2017) {
break;
}
// fallthrough
default:
diagnostics.add(
createDiagnosticForNode(forInOrOfStatement.awaitModifier,
Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher
)
);
break;
}
}
}
@@ -44947,11 +44986,11 @@ 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_es2022_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_node16_or_nodenext);
}
if (node.typeArguments) {
return grammarErrorOnNode(node, Diagnostics.Dynamic_import_cannot_have_type_arguments);
return grammarErrorOnNode(node, Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
}
const nodeArguments = node.arguments;
@@ -44961,7 +45000,7 @@ namespace ts {
if (nodeArguments.length > 1) {
const assertionArgument = nodeArguments[1];
return grammarErrorOnNode(assertionArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext);
return grammarErrorOnNode(assertionArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext);
}
}
+3 -3
View File
@@ -423,7 +423,7 @@ namespace ts {
es2020: ModuleKind.ES2020,
es2022: ModuleKind.ES2022,
esnext: ModuleKind.ESNext,
node12: ModuleKind.Node12,
node16: ModuleKind.Node16,
nodenext: ModuleKind.NodeNext,
})),
affectsModuleResolution: true,
@@ -781,7 +781,7 @@ namespace ts {
type: new Map(getEntries({
node: ModuleResolutionKind.NodeJs,
classic: ModuleResolutionKind.Classic,
node12: ModuleResolutionKind.Node12,
node16: ModuleResolutionKind.Node16,
nodenext: ModuleResolutionKind.NodeNext,
})),
affectsModuleResolution: true,
@@ -1263,7 +1263,7 @@ namespace ts {
affectsModuleResolution: true,
description: Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
category: Diagnostics.Language_and_Environment,
defaultValueDescription: Diagnostics.auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node12_as_modules,
defaultValueDescription: Diagnostics.auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules,
}
];
+15 -22
View File
@@ -900,6 +900,10 @@
"category": "Error",
"code": 1308
},
"The current file is a CommonJS module and cannot use 'await' at the top level.": {
"category": "Error",
"code": 1309
},
"Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern.": {
"category": "Error",
"code": 1312
@@ -944,11 +948,11 @@
"category": "Error",
"code": 1322
},
"Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', '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', 'node16', or 'nodenext'.": {
"category": "Error",
"code": 1323
},
"Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.": {
"Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.": {
"category": "Error",
"code": 1324
},
@@ -956,7 +960,7 @@
"category": "Error",
"code": 1325
},
"Dynamic import cannot have type arguments.": {
"This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.": {
"category": "Error",
"code": 1326
},
@@ -1016,7 +1020,7 @@
"category": "Error",
"code": 1342
},
"The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.": {
"The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.": {
"category": "Error",
"code": 1343
},
@@ -1140,7 +1144,7 @@
"category": "Message",
"code": 1377
},
"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.": {
"Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher.": {
"category": "Error",
"code": 1378
},
@@ -1348,7 +1352,7 @@
"category": "Error",
"code": 1431
},
"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.": {
"Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher.": {
"category": "Error",
"code": 1432
},
@@ -1420,7 +1424,7 @@
"category": "Error",
"code": 1451
},
"Resolution modes are only supported when `moduleResolution` is `node12` or `nodenext`.": {
"Resolution modes are only supported when `moduleResolution` is `node16` or `nodenext`.": {
"category": "Error",
"code": 1452
},
@@ -1465,7 +1469,7 @@
"category": "Message",
"code": 1475
},
"\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node12+) as modules.": {
"\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules.": {
"category": "Message",
"code": 1476
},
@@ -1506,10 +1510,6 @@
"category": "Error",
"code": 2207
},
"This type parameter probably needs an `extends object` constraint.": {
"category": "Error",
"code": 2208
},
"Duplicate identifier '{0}'.": {
"category": "Error",
@@ -2511,10 +2511,7 @@
"category": "Error",
"code": 2568
},
"Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.": {
"category": "Error",
"code": 2569
},
"Could not find name '{0}'. Did you mean '{1}'?": {
"category": "Error",
"code": 2570
@@ -3425,11 +3422,11 @@
"category": "Error",
"code": 2833
},
"Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path.": {
"Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.": {
"category": "Error",
"code": 2834
},
"Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?": {
"Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '{0}'?": {
"category": "Error",
"code": 2835
},
@@ -6113,10 +6110,6 @@
"category": "Error",
"code": 7061
},
"JSON imports are experimental in ES module mode imports.": {
"category": "Error",
"code": 7062
},
"You cannot rename this element.": {
"category": "Error",
+1 -1
View File
@@ -5275,7 +5275,7 @@ namespace ts {
hasNoDefaultLib: boolean,
libReferences: readonly FileReference[]
) {
const node = baseFactory.createBaseSourceFileNode(SyntaxKind.SourceFile) as Mutable<SourceFile>;
const node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(SyntaxKind.SourceFile)) as Mutable<SourceFile>;
for (const p in source) {
if (p === "emitNode" || hasProperty(node, p) || !hasProperty(source, p)) continue;
(node as any)[p] = (source as any)[p];
+12 -12
View File
@@ -352,9 +352,9 @@ namespace ts {
// set in a non-modal module resolution setting here. Do note that our behavior is not particularly well defined when these mode-overriding imports
// are present in a non-modal project; while in theory we'd like to either ignore the mode or provide faithful modern resolution, depending on what we feel is best,
// in practice, not every cache has the options available to intelligently make the choice to ignore the mode request, and it's unclear how modern "faithful modern
// resolution" should be (`node12`? `nodenext`?). As such, witnessing a mode-overriding triple-slash reference in a non-modal module resolution
// resolution" should be (`node16`? `nodenext`?). As such, witnessing a mode-overriding triple-slash reference in a non-modal module resolution
// context should _probably_ be an error - and that should likely be handled by the `Program` (which is what we do).
if (resolutionMode === ModuleKind.ESNext && (getEmitModuleResolutionKind(options) === ModuleResolutionKind.Node12 || getEmitModuleResolutionKind(options) === ModuleResolutionKind.NodeNext)) {
if (resolutionMode === ModuleKind.ESNext && (getEmitModuleResolutionKind(options) === ModuleResolutionKind.Node16 || getEmitModuleResolutionKind(options) === ModuleResolutionKind.NodeNext)) {
features |= NodeResolutionFeatures.EsmMode;
}
const conditions = features & NodeResolutionFeatures.Exports ? features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] : [];
@@ -448,7 +448,7 @@ namespace ts {
}
function getDefaultNodeResolutionFeatures(options: CompilerOptions) {
return getEmitModuleResolutionKind(options) === ModuleResolutionKind.Node12 ? NodeResolutionFeatures.Node12Default :
return getEmitModuleResolutionKind(options) === ModuleResolutionKind.Node16 ? NodeResolutionFeatures.Node16Default :
getEmitModuleResolutionKind(options) === ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault :
NodeResolutionFeatures.None;
}
@@ -955,8 +955,8 @@ namespace ts {
case ModuleKind.CommonJS:
moduleResolution = ModuleResolutionKind.NodeJs;
break;
case ModuleKind.Node12:
moduleResolution = ModuleResolutionKind.Node12;
case ModuleKind.Node16:
moduleResolution = ModuleResolutionKind.Node16;
break;
case ModuleKind.NodeNext:
moduleResolution = ModuleResolutionKind.NodeNext;
@@ -977,8 +977,8 @@ namespace ts {
perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
switch (moduleResolution) {
case ModuleResolutionKind.Node12:
result = node12ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
case ModuleResolutionKind.Node16:
result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
break;
case ModuleResolutionKind.NodeNext:
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
@@ -1236,22 +1236,22 @@ namespace ts {
// respecting the `.exports` member of packages' package.json files and its (conditional) mappings of export names
Exports = 1 << 3,
// allowing `*` in the LHS of an export to be followed by more content, eg `"./whatever/*.js"`
// not currently backported to node 12 - https://github.com/nodejs/Release/issues/690
// not supported in node 12 - https://github.com/nodejs/Release/issues/690
ExportsPatternTrailers = 1 << 4,
AllFeatures = Imports | SelfName | Exports | ExportsPatternTrailers,
Node12Default = Imports | SelfName | Exports,
Node16Default = Imports | SelfName | Exports | ExportsPatternTrailers,
NodeNextDefault = AllFeatures,
EsmMode = 1 << 5,
}
function node12ModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions,
function node16ModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions,
host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference,
resolutionMode?: ModuleKind.CommonJS | ModuleKind.ESNext): ResolvedModuleWithFailedLookupLocations {
return nodeNextModuleNameResolverWorker(
NodeResolutionFeatures.Node12Default,
NodeResolutionFeatures.Node16Default,
moduleName,
containingFile,
compilerOptions,
@@ -1316,7 +1316,7 @@ namespace ts {
const failedLookupLocations: string[] = [];
const affectingLocations: string[] = [];
// conditions are only used by the node12/nodenext resolver - there's no priority order in the list,
// conditions are only used by the node16/nodenext resolver - there's no priority order in the list,
//it's essentially a set (priority is determined by object insertion order in the object we look at).
const conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
if (compilerOptions.noDtsResolution) {
+2 -2
View File
@@ -41,7 +41,7 @@ namespace ts.moduleSpecifiers {
}
function isFormatRequiringExtensions(compilerOptions: CompilerOptions, importingSourceFileName: Path, host: ModuleSpecifierResolutionHost) {
if (getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Node12
if (getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Node16
&& getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.NodeNext) {
return false;
}
@@ -734,7 +734,7 @@ namespace ts.moduleSpecifiers {
const cachedPackageJson = host.getPackageJsonInfoCache?.()?.getPackageJsonInfo(packageJsonPath);
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
const packageJsonContent = cachedPackageJson?.packageJsonContent || JSON.parse(host.readFile!(packageJsonPath)!);
if (getEmitModuleResolutionKind(options) === ModuleResolutionKind.Node12 || getEmitModuleResolutionKind(options) === ModuleResolutionKind.NodeNext) {
if (getEmitModuleResolutionKind(options) === ModuleResolutionKind.Node16 || getEmitModuleResolutionKind(options) === ModuleResolutionKind.NodeNext) {
// `conditions` *could* be made to go against `importingSourceFile.impliedNodeFormat` if something wanted to generate
// an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
// usually called to conjure an import out of thin air, we don't have an existing usage to call `getModeForUsageAtIndex`
+1 -1
View File
@@ -683,7 +683,7 @@ namespace ts {
/**
* Controls the format the file is detected as - this can be derived from only the path
* and files on disk, but needs to be done with a module resolution cache in scope to be performant.
* This is usually `undefined` for compilations that do not have `moduleResolution` values of `node12` or `nodenext`.
* This is usually `undefined` for compilations that do not have `moduleResolution` values of `node16` or `nodenext`.
*/
impliedNodeFormat?: ModuleKind.ESNext | ModuleKind.CommonJS;
/**
+5 -5
View File
@@ -858,7 +858,7 @@ namespace ts {
*/
export function getImpliedNodeFormatForFile(fileName: Path, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ModuleKind.ESNext | ModuleKind.CommonJS | undefined {
switch (getEmitModuleResolutionKind(options)) {
case ModuleResolutionKind.Node12:
case ModuleResolutionKind.Node16:
case ModuleResolutionKind.NodeNext:
return fileExtensionIsOneOf(fileName, [Extension.Dmts, Extension.Mts, Extension.Mjs]) ? ModuleKind.ESNext :
fileExtensionIsOneOf(fileName, [Extension.Dcts, Extension.Cts, Extension.Cjs]) ? ModuleKind.CommonJS :
@@ -1210,7 +1210,7 @@ namespace ts {
const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
const resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
for (let i = 0; i < typeReferences.length; i++) {
// under node12/nodenext module resolution, load `types`/ata include names as cjs resolution results by passing an `undefined` mode
// under node16/nodenext module resolution, load `types`/ata include names as cjs resolution results by passing an `undefined` mode
processTypeReferenceDirective(typeReferences[i], /*mode*/ undefined, resolutions[i], { kind: FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: resolutions[i]?.packageId });
}
tracing?.pop();
@@ -3085,8 +3085,8 @@ namespace ts {
const fileName = toFileNameLowerCase(ref.fileName);
setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
const mode = ref.resolutionMode || file.impliedNodeFormat;
if (mode && getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Node12 && getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeNext) {
programDiagnostics.add(createDiagnosticForRange(file, ref, Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node12_or_nodenext));
if (mode && getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Node16 && getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeNext) {
programDiagnostics.add(createDiagnosticForRange(file, ref, Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
}
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: FileIncludeKind.TypeReferenceDirective, file: file.path, index, });
}
@@ -3515,7 +3515,7 @@ namespace ts {
if (options.resolveJsonModule) {
if (getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeJs &&
getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Node12 &&
getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Node16 &&
getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeNext) {
createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
}
+1 -1
View File
@@ -9,7 +9,7 @@ namespace ts {
return transformECMAScriptModule;
case ModuleKind.System:
return transformSystemModule;
case ModuleKind.Node12:
case ModuleKind.Node16:
case ModuleKind.NodeNext:
return transformNodeModule;
default:
+10 -9
View File
@@ -3615,7 +3615,7 @@ namespace ts {
languageVersion: ScriptTarget;
/**
* When `module` is `Node12` or `NodeNext`, this field controls whether the
* When `module` is `Node16` or `NodeNext`, this field controls whether the
* source file in question is an ESNext-output-format file, or a CommonJS-output-format
* module. This is derived by the module resolver as it looks up the file, since
* it is derived from either the file extension of the module, or the containing
@@ -6049,11 +6049,12 @@ namespace ts {
Classic = 1,
NodeJs = 2,
// Starting with node12, node's module resolver has significant departures from traditional cjs resolution
// to better support ecmascript modules and their use within node - more features are still being added, so
// we can expect it to change over time, and as such, offer both a `NodeNext` moving resolution target, and a `Node12`
// version-anchored resolution target
Node12 = 3,
NodeNext = 99, // Not simply `Node12` so that compiled code linked against TS can use the `Next` value reliably (same as with `ModuleKind`)
// to better support ecmascript modules and their use within node - however more features are still being added.
// TypeScript's Node ESM support was introduced after Node 12 went end-of-life, and Node 14 is the earliest stable
// version that supports both pattern trailers - *but*, Node 16 is the first version that also supports ECMASCript 2022.
// In turn, we offer both a `NodeNext` moving resolution target, and a `Node16` version-anchored resolution target
Node16 = 3,
NodeNext = 99, // Not simply `Node16` so that compiled code linked against TS can use the `Next` value reliably (same as with `ModuleKind`)
}
export enum ModuleDetectionKind {
@@ -6062,7 +6063,7 @@ namespace ts {
*/
Legacy = 1,
/**
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution: node12+
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution: node16+
*/
Auto = 2,
/**
@@ -6281,8 +6282,8 @@ namespace ts {
ES2022 = 7,
ESNext = 99,
// Node12+ is an amalgam of commonjs (albeit updated) and es2020+, and represents a distinct module system from es2020/esnext
Node12 = 100,
// Node16+ is an amalgam of commonjs (albeit updated) and es2022+, and represents a distinct module system from es2020/esnext
Node16 = 100,
NodeNext = 199,
}
+8 -8
View File
@@ -808,7 +808,7 @@ namespace ts {
}
function isCommonJSContainingModuleKind(kind: ModuleKind) {
return kind === ModuleKind.CommonJS || kind === ModuleKind.Node12 || kind === ModuleKind.NodeNext;
return kind === ModuleKind.CommonJS || kind === ModuleKind.Node16 || kind === ModuleKind.NodeNext;
}
export function isEffectiveExternalModule(node: SourceFile, compilerOptions: CompilerOptions) {
@@ -6319,7 +6319,7 @@ namespace ts {
file.externalModuleIndicator = isFileProbablyExternalModule(file);
};
case ModuleDetectionKind.Auto:
// If module is nodenext or node12, all esm format files are modules
// If module is nodenext or node16, all esm format files are modules
// If jsx is react-jsx or react-jsxdev then jsx tags force module-ness
// otherwise, the presence of import or export statments (or import.meta) implies module-ness
const checks: ((file: SourceFile) => Node | true | undefined)[] = [isFileProbablyExternalModule];
@@ -6327,7 +6327,7 @@ namespace ts {
checks.push(isFileModuleFromUsingJSXTag);
}
const moduleKind = getEmitModuleKind(options);
if (moduleKind === ModuleKind.Node12 || moduleKind === ModuleKind.NodeNext) {
if (moduleKind === ModuleKind.Node16 || moduleKind === ModuleKind.NodeNext) {
checks.push(isFileForcedToBeModuleByFormat);
}
const combined = or(...checks);
@@ -6338,7 +6338,7 @@ namespace ts {
export function getEmitScriptTarget(compilerOptions: {module?: CompilerOptions["module"], target?: CompilerOptions["target"]}) {
return compilerOptions.target ||
(compilerOptions.module === ModuleKind.Node12 && ScriptTarget.ES2020) ||
(compilerOptions.module === ModuleKind.Node16 && ScriptTarget.ES2022) ||
(compilerOptions.module === ModuleKind.NodeNext && ScriptTarget.ESNext) ||
ScriptTarget.ES3;
}
@@ -6356,8 +6356,8 @@ namespace ts {
case ModuleKind.CommonJS:
moduleResolution = ModuleResolutionKind.NodeJs;
break;
case ModuleKind.Node12:
moduleResolution = ModuleResolutionKind.Node12;
case ModuleKind.Node16:
moduleResolution = ModuleResolutionKind.Node16;
break;
case ModuleKind.NodeNext:
moduleResolution = ModuleResolutionKind.NodeNext;
@@ -6382,7 +6382,7 @@ namespace ts {
case ModuleKind.ES2020:
case ModuleKind.ES2022:
case ModuleKind.ESNext:
case ModuleKind.Node12:
case ModuleKind.Node16:
case ModuleKind.NodeNext:
return true;
default:
@@ -6407,7 +6407,7 @@ namespace ts {
return compilerOptions.esModuleInterop;
}
switch (getEmitModuleKind(compilerOptions)) {
case ModuleKind.Node12:
case ModuleKind.Node16:
case ModuleKind.NodeNext:
return true;
}
+16 -2
View File
@@ -38,6 +38,7 @@ namespace ts.server {
private lineMaps = new Map<string, number[]>();
private messages: string[] = [];
private lastRenameEntry: RenameEntry | undefined;
private preferences: UserPreferences | undefined;
constructor(private host: SessionClientHost) {
}
@@ -124,6 +125,7 @@ namespace ts.server {
/*@internal*/
configure(preferences: UserPreferences) {
this.preferences = preferences;
const args: protocol.ConfigureRequestArguments = { preferences };
const request = this.processRequest(CommandNames.Configure, args);
this.processResponse(request, /*expectEmptyBody*/ true);
@@ -488,13 +490,25 @@ namespace ts.server {
return notImplemented();
}
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[] {
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename?: boolean): RenameLocation[] {
if (!this.lastRenameEntry ||
this.lastRenameEntry.inputs.fileName !== fileName ||
this.lastRenameEntry.inputs.position !== position ||
this.lastRenameEntry.inputs.findInStrings !== findInStrings ||
this.lastRenameEntry.inputs.findInComments !== findInComments) {
this.getRenameInfo(fileName, position, { allowRenameOfImportPath: true }, findInStrings, findInComments);
if (providePrefixAndSuffixTextForRename !== undefined) {
// User preferences have to be set through the `Configure` command
this.configure({ providePrefixAndSuffixTextForRename });
// Options argument is not used, so don't pass in options
this.getRenameInfo(fileName, position, /*options*/{}, findInStrings, findInComments);
// Restore previous user preferences
if (this.preferences) {
this.configure(this.preferences);
}
}
else {
this.getRenameInfo(fileName, position, /*options*/{}, findInStrings, findInComments);
}
}
return this.lastRenameEntry!.locations;
+1 -1
View File
@@ -249,7 +249,7 @@ namespace compiler {
}
// establish defaults (aligns with old harness)
if (compilerOptions.target === undefined && compilerOptions.module !== ts.ModuleKind.Node12 && compilerOptions.module !== ts.ModuleKind.NodeNext) compilerOptions.target = ts.ScriptTarget.ES3;
if (compilerOptions.target === undefined && compilerOptions.module !== ts.ModuleKind.Node16 && compilerOptions.module !== ts.ModuleKind.NodeNext) compilerOptions.target = ts.ScriptTarget.ES3;
if (compilerOptions.newLine === undefined) compilerOptions.newLine = ts.NewLineKind.CarriageReturnLineFeed;
if (compilerOptions.skipDefaultLibCheck === undefined) compilerOptions.skipDefaultLibCheck = true;
if (compilerOptions.noErrorTruncation === undefined) compilerOptions.noErrorTruncation = true;
+4 -4
View File
@@ -673,6 +673,7 @@ interface DataView {
* Gets the BigInt64 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
* @param littleEndian If false or undefined, a big-endian value should be read.
*/
getBigInt64(byteOffset: number, littleEndian?: boolean): bigint;
@@ -680,6 +681,7 @@ interface DataView {
* Gets the BigUint64 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
* @param littleEndian If false or undefined, a big-endian value should be read.
*/
getBigUint64(byteOffset: number, littleEndian?: boolean): bigint;
@@ -687,8 +689,7 @@ interface DataView {
* Stores a BigInt64 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
* @param littleEndian If false or undefined, a big-endian value should be written.
*/
setBigInt64(byteOffset: number, value: bigint, littleEndian?: boolean): void;
@@ -696,8 +697,7 @@ interface DataView {
* Stores a BigUint64 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
* @param littleEndian If false or undefined, a big-endian value should be written.
*/
setBigUint64(byteOffset: number, value: bigint, littleEndian?: boolean): void;
}
+14 -14
View File
@@ -52,13 +52,13 @@ declare function decodeURIComponent(encodedURIComponent: string): string;
/**
* Encodes a text string as a valid Uniform Resource Identifier (URI)
* @param uri A value representing an encoded URI.
* @param uri A value representing an unencoded URI.
*/
declare function encodeURI(uri: string): string;
/**
* Encodes a text string as a valid component of a Uniform Resource Identifier (URI).
* @param uriComponent A value representing an encoded URI component.
* @param uriComponent A value representing an unencoded URI component.
*/
declare function encodeURIComponent(uriComponent: string | number | boolean): string;
@@ -1669,6 +1669,7 @@ interface DataView {
* Gets the Float32 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
* @param littleEndian If false or undefined, a big-endian value should be read.
*/
getFloat32(byteOffset: number, littleEndian?: boolean): number;
@@ -1676,6 +1677,7 @@ interface DataView {
* Gets the Float64 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
* @param littleEndian If false or undefined, a big-endian value should be read.
*/
getFloat64(byteOffset: number, littleEndian?: boolean): number;
@@ -1690,12 +1692,14 @@ interface DataView {
* Gets the Int16 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
* @param littleEndian If false or undefined, a big-endian value should be read.
*/
getInt16(byteOffset: number, littleEndian?: boolean): number;
/**
* Gets the Int32 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
* @param littleEndian If false or undefined, a big-endian value should be read.
*/
getInt32(byteOffset: number, littleEndian?: boolean): number;
@@ -1710,6 +1714,7 @@ interface DataView {
* Gets the Uint16 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
* @param littleEndian If false or undefined, a big-endian value should be read.
*/
getUint16(byteOffset: number, littleEndian?: boolean): number;
@@ -1717,6 +1722,7 @@ interface DataView {
* Gets the Uint32 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
* @param littleEndian If false or undefined, a big-endian value should be read.
*/
getUint32(byteOffset: number, littleEndian?: boolean): number;
@@ -1724,8 +1730,7 @@ interface DataView {
* Stores an Float32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
* @param littleEndian If false or undefined, a big-endian value should be written.
*/
setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void;
@@ -1733,8 +1738,7 @@ interface DataView {
* Stores an Float64 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
* @param littleEndian If false or undefined, a big-endian value should be written.
*/
setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void;
@@ -1749,8 +1753,7 @@ interface DataView {
* Stores an Int16 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
* @param littleEndian If false or undefined, a big-endian value should be written.
*/
setInt16(byteOffset: number, value: number, littleEndian?: boolean): void;
@@ -1758,8 +1761,7 @@ interface DataView {
* Stores an Int32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
* @param littleEndian If false or undefined, a big-endian value should be written.
*/
setInt32(byteOffset: number, value: number, littleEndian?: boolean): void;
@@ -1774,8 +1776,7 @@ interface DataView {
* Stores an Uint16 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
* @param littleEndian If false or undefined, a big-endian value should be written.
*/
setUint16(byteOffset: number, value: number, littleEndian?: boolean): void;
@@ -1783,8 +1784,7 @@ interface DataView {
* Stores an Uint32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
* @param littleEndian If false or undefined, a big-endian value should be written.
*/
setUint32(byteOffset: number, value: number, littleEndian?: boolean): void;
}
@@ -5349,18 +5349,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_cannot_have_type_arguments_1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[动态导入不能含有类型参数。]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import's specifier must be of type 'string', but here has type '{0}'.]]></Val>
@@ -5997,6 +5985,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[应为 1 个参数,但得到 0。“new Promise()” 需要 JSDoc 提示才能生成可在没有参数的情况下调用的 “resolve”。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_at_least_0_arguments_but_got_1_2555" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected at least {0} arguments, but got {1}.]]></Val>
@@ -13740,6 +13737,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[“import” 的这种用法无效。可以写入 “import()” 调用,但它们必须具有括号,并且不能带有类型参数。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[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.]]></Val>
@@ -13977,15 +13983,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[类型“{0}”不是数组类型或字符串类型。请使用编译器选项 "--downlevelIteration" 允许迭代器进行迭代。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]5D;()' method that returns an iterator.]]></Val>
@@ -5349,18 +5349,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_cannot_have_type_arguments_1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[動態匯入不可有型別引數。]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import's specifier must be of type 'string', but here has type '{0}'.]]></Val>
@@ -5997,6 +5985,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[需要 1 個引數,但得到 0。'new Promise()' 需要 JSDoc 提示,才能產生可以呼叫而不含引數的 'resolve'。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_at_least_0_arguments_but_got_1_2555" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected at least {0} arguments, but got {1}.]]></Val>
@@ -13740,6 +13737,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[此 'import' 的使用方式無效。'import()' 呼叫可以寫入,但必須有括弧,而且不能有類型引數。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[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.]]></Val>
@@ -13977,15 +13983,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[類型 '{0}' 不是陣列類型或字串類型。請使用編譯器選項 '-downlevelIteration' 允許逐一查看迭代器。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]5D;()' method that returns an iterator.]]></Val>
@@ -5358,18 +5358,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_cannot_have_type_arguments_1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Dynamický import nemůže mít argumenty typu.]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import's specifier must be of type 'string', but here has type '{0}'.]]></Val>
@@ -6006,6 +5994,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Očekával se 1 argument, ale bylo jich 0. New Promise() potřebuje pomocný parametr JSDoc k vytvoření resolve, který se dá volat bez argumentů.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_at_least_0_arguments_but_got_1_2555" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected at least {0} arguments, but got {1}.]]></Val>
@@ -13749,6 +13746,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Toto použití importu není platné. Volání import() se dají zapsat, ale musí mít závorky a nemůžou mít typové argumenty.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[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.]]></Val>
@@ -13986,15 +13992,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Typ {0} není typem pole ani typem řetězce. Pokud chcete povolit iteraci iterátorů, použijte možnost kompilátoru --downlevelIteration.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]5D;()' method that returns an iterator.]]></Val>
@@ -5346,18 +5346,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_cannot_have_type_arguments_1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Der dynamische Import kann keine Typargumente aufweisen.]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import's specifier must be of type 'string', but here has type '{0}'.]]></Val>
@@ -5994,6 +5982,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[1 Argument erwartet, aber 0 erhalten. „new Promise()“ benötigt einen JSDoc-Hinweis, um einen „resolve“ zu erzeugen, der ohne Argumente aufgerufen werden kann.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_at_least_0_arguments_but_got_1_2555" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected at least {0} arguments, but got {1}.]]></Val>
@@ -13734,6 +13731,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Diese Verwendung von „import“ ist ungültig. „import()“-Aufrufe können geschrieben werden, müssen jedoch Klammern aufweisen und dürfen keine Typargumente aufweisen.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[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.]]></Val>
@@ -13971,15 +13977,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Der Typ "{0}" ist kein Arraytyp oder Zeichenfolgentyp. Verwenden Sie die Compileroption "--downlevelIteration", um das Durchlaufen von Iteratoren zuzulassen.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]5D;()' method that returns an iterator.]]></Val>
@@ -5361,18 +5361,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_cannot_have_type_arguments_1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[La importación dinámica no puede tener argumentos de tipo.]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import's specifier must be of type 'string', but here has type '{0}'.]]></Val>
@@ -6009,6 +5997,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Se esperaba 1 argumento, pero se obtuvo 0. "new Promise()" necesita una pista de JSDoc para producir un "resolve" que pueda llamarse sin argumentos.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_at_least_0_arguments_but_got_1_2555" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected at least {0} arguments, but got {1}.]]></Val>
@@ -13752,6 +13749,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Este uso de "import" no es válido. Se pueden escribir llamadas "import()", pero deben tener paréntesis y no pueden tener argumentos de tipo.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[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.]]></Val>
@@ -13989,15 +13995,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA["{0}" no es un tipo de matriz o de cadena. Use la opción del compilador "--downlevelIteration" para permitir la iteración de los iteradores.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]5D;()' method that returns an iterator.]]></Val>
@@ -5361,18 +5361,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_cannot_have_type_arguments_1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[L'importation dynamique ne peut pas avoir d'arguments de type.]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import's specifier must be of type 'string', but here has type '{0}'.]]></Val>
@@ -6009,6 +5997,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[1 argument attendu, mais 0 obtenu. 'new Promise()' a besoin dun indicateur JSDoc pour produire un 'resolve' qui peut être appelé sans arguments.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_at_least_0_arguments_but_got_1_2555" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected at least {0} arguments, but got {1}.]]></Val>
@@ -13752,6 +13749,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Cette utilisation de « import » nest pas valide. Les appels « import() » peuvent être écrits, mais ils doivent avoir des parenthèses et ne peuvent pas avoir darguments de type.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[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.]]></Val>
@@ -13989,15 +13995,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Le type '{0}' nest pas un type de tableau ou un type string. Utilisez l'option du compilateur '--downlevelIteration' pour autoriser l'itération des itérateurs.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]5D;()' method that returns an iterator.]]></Val>
@@ -5349,18 +5349,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_cannot_have_type_arguments_1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Nell'importazione dinamica non possono essere presenti argomenti tipo.]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import's specifier must be of type 'string', but here has type '{0}'.]]></Val>
@@ -5997,6 +5985,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Previsto 1 argomento, ma ottenuto 0. 'new Promise()' richiede un hint JSDoc per produrre un elemento 'resolve' che possa essere chiamato senza argomenti.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_at_least_0_arguments_but_got_1_2555" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected at least {0} arguments, but got {1}.]]></Val>
@@ -13740,6 +13737,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Questo uso di 'import' non è valido. le chiamate 'import()' possono essere scritte, ma devono avere parentesi e non possono avere argomenti di tipo.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[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.]]></Val>
@@ -13977,15 +13983,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Il tipo '{0}' non è un tipo matrice o stringa. Usare l'opzione del compilatore '--downlevelIteration' per consentire l'iterazione degli iteratori.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]5D;()' method that returns an iterator.]]></Val>
@@ -5349,18 +5349,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_cannot_have_type_arguments_1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[動的インポートに型引数を指定することはできません。]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import's specifier must be of type 'string', but here has type '{0}'.]]></Val>
@@ -5997,6 +5985,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[1 個の引数が必要ですが、0 個しかありませんでした。'new Promise()' では、引数なしで呼び出すことができる 'resolve' を生成するための JSDoc ヒントが必要です。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_at_least_0_arguments_but_got_1_2555" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected at least {0} arguments, but got {1}.]]></Val>
@@ -13740,6 +13737,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[この 'import' の使用は無効です。'import()' 呼び出しは書き込むことができますが、かっこが必要であり、型引数を指定することはできません。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[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.]]></Val>
@@ -13977,15 +13983,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[型 '{0}' は配列型でも文字列型でもありません。反復子の反復を許可するには、コンパイラ オプション '--downlevelIteration' を使用します。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]5D;()' method that returns an iterator.]]></Val>
@@ -5349,18 +5349,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_cannot_have_type_arguments_1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[동적 가져오기에는 형식 인수를 사용할 수 없습니다.]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import's specifier must be of type 'string', but here has type '{0}'.]]></Val>
@@ -5997,6 +5985,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[1개의 인수가 필요하지만 0이 있습니다. 'new Promise()'는 인수 없이 호출할 수 있는 'resolve'를 생성하기 위해 JSDoc 힌트가 필요합니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_at_least_0_arguments_but_got_1_2555" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected at least {0} arguments, but got {1}.]]></Val>
@@ -13740,6 +13737,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[이 '가져오기' 사용은 유효하지 않습니다. 'import()' 호출을 작성할 수 있지만 괄호가 있어야 하며 유형 인수를 가질 수 없습니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[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.]]></Val>
@@ -13977,15 +13983,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' 형식이 배열 형식 또는 문자열 형식이 아닙니다. 컴파일러 옵션 '-downlevelIteration'을 사용하여 반복기의 반복을 허용하세요.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]5D;()' method that returns an iterator.]]></Val>
@@ -5339,18 +5339,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_cannot_have_type_arguments_1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Dynamiczny import nie może mieć argumentów typu.]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import's specifier must be of type 'string', but here has type '{0}'.]]></Val>
@@ -5987,6 +5975,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Oczekiwano 1 argumentu, ale otrzymano 0. Element „new Promise()” wymaga wskazówki JSDoc, aby utworzyć element „resolve”, który można wywołać bez argumentów.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_at_least_0_arguments_but_got_1_2555" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected at least {0} arguments, but got {1}.]]></Val>
@@ -13727,6 +13724,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[To użycie elementu „import” jest nieprawidłowe. Wywołania „import()” mogą być zapisywane, ale muszą mieć nawiasy i nie mogą mieć argumentów typu.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[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.]]></Val>
@@ -13964,15 +13970,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Typ „{0}” nie jest typem tablicy ani typem ciągu. Użyj opcji kompilatora „--downlevelIteration”, aby zezwolić na iterowanie iteratorów.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]5D;()' method that returns an iterator.]]></Val>
@@ -5342,18 +5342,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_cannot_have_type_arguments_1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[A importação dinâmica não pode ter argumentos de tipo.]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import's specifier must be of type 'string', but here has type '{0}'.]]></Val>
@@ -5990,6 +5978,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Esperava 1 argumento, mas obteve 0. 'new Promise()' precisa de uma dica JSDoc para produzir um 'resolver' que pode ser chamado sem argumentos.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_at_least_0_arguments_but_got_1_2555" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected at least {0} arguments, but got {1}.]]></Val>
@@ -13730,6 +13727,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Este uso de 'importar' é inválido. Chamadas 'import()' podem ser escritas, mas devem ter parênteses e não podem ter argumentos de tipo.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[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.]]></Val>
@@ -13967,15 +13973,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[O tipo '{0}' não é um tipo de matriz nem um tipo de cadeia de caracteres. Use a opção do compilador '--downlevelIteration' para permitir a iteração dos iteradores.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]5D;()' method that returns an iterator.]]></Val>
@@ -5348,18 +5348,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_cannot_have_type_arguments_1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[При динамическом импорте не могут использоваться аргументы типов.]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import's specifier must be of type 'string', but here has type '{0}'.]]></Val>
@@ -5996,6 +5984,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Ожидался 1 аргумент, получено 0. Для "new Promise()" требуется указание JSDoc, чтобы создать "resolve" с возможностью вызова без аргументов.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_at_least_0_arguments_but_got_1_2555" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected at least {0} arguments, but got {1}.]]></Val>
@@ -13739,6 +13736,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Недопустимое использование "import". Можно записывать вызовы "import()", но у них должны быть скобки и не должно быть аргументов типа.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[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.]]></Val>
@@ -13976,15 +13982,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Тип "{0}" не является типом строки или массива. Используйте параметр компилятора "--downlevelIteration", чтобы разрешить итерацию итераторов.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]5D;()' method that returns an iterator.]]></Val>
@@ -5342,18 +5342,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_cannot_have_type_arguments_1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Dinamik içeri aktarma, tür bağımsız değişkenleri içeremez.]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Dynamic import cannot have type arguments]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Dynamic import's specifier must be of type 'string', but here has type '{0}'.]]></Val>
@@ -5990,6 +5978,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[1 bağımsız değişken bekleniyordu ancak 0 bağımsız değişken var. Bağımsız değişkenler olmadan çağrılabilen bir 'resolve' oluşturmak için 'new Promise()' çağrısında bir JSDoc ipucu bulunması gerekir.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Expected_at_least_0_arguments_but_got_1_2555" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Expected at least {0} arguments, but got {1}.]]></Val>
@@ -13733,6 +13730,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['import' çağrısının bu kullanımı geçersiz. 'import()' çağrıları yazılabilir ancak ayraç içermeleri gerekir ve tür bağımsız değişkenleri içeremezler.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[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.]]></Val>
@@ -13970,15 +13976,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA['{0}' türü bir dizi türü veya bir dize türü değil. Yineleyicilerin yinelenmesine izin vermek için '--downlevelIteration' derleyici seçeneğini kullanın.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]5D;()' method that returns an iterator.]]></Val>
+10 -7
View File
@@ -317,6 +317,7 @@ namespace ts.server {
projects,
defaultProject,
initialLocation,
/*isForRename*/ true,
(project, location, tryAddToTodo) => {
const projectOutputs = project.getLanguageService().findRenameLocations(location.fileName, location.pos, findInStrings, findInComments, providePrefixAndSuffixTextForRename);
if (projectOutputs) {
@@ -332,8 +333,8 @@ namespace ts.server {
return outputs;
}
function getDefinitionLocation(defaultProject: Project, initialLocation: DocumentPosition): DocumentPosition | undefined {
const infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos);
function getDefinitionLocation(defaultProject: Project, initialLocation: DocumentPosition, isForRename: boolean): DocumentPosition | undefined {
const infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos, /*searchOtherFilesOnly*/ false, isForRename);
const info = infos && firstOrUndefined(infos);
return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : undefined;
}
@@ -350,6 +351,7 @@ namespace ts.server {
projects,
defaultProject,
initialLocation,
/*isForRename*/ false,
(project, location, getMappedLocation) => {
logger.info(`Finding references to ${location.fileName} position ${location.pos} in project ${project.getProjectName()}`);
const projectOutputs = project.getLanguageService().findReferences(location.fileName, location.pos);
@@ -417,7 +419,8 @@ namespace ts.server {
projects: Projects,
defaultProject: Project,
initialLocation: TLocation,
cb: CombineProjectOutputCallback<TLocation>
isForRename: boolean,
cb: CombineProjectOutputCallback<TLocation>,
): void {
const projectService = defaultProject.projectService;
let toDo: ProjectAndLocation<TLocation>[] | undefined;
@@ -430,7 +433,7 @@ namespace ts.server {
// After initial references are collected, go over every other project and see if it has a reference for the symbol definition.
if (initialLocation) {
const defaultDefinition = getDefinitionLocation(defaultProject, initialLocation);
const defaultDefinition = getDefinitionLocation(defaultProject, initialLocation, isForRename);
if (defaultDefinition) {
const getGeneratedDefinition = memoize(() => defaultProject.isSourceOfProjectReferenceRedirect(defaultDefinition.fileName) ?
defaultDefinition :
@@ -1243,7 +1246,7 @@ namespace ts.server {
definitions?.forEach(d => definitionSet.add(d));
const noDtsProject = project.getNoDtsResolutionProject([file]);
const ls = noDtsProject.getLanguageService();
const jsDefinitions = ls.getDefinitionAtPosition(file, position, /*searchOtherFilesOnly*/ true)
const jsDefinitions = ls.getDefinitionAtPosition(file, position, /*searchOtherFilesOnly*/ true, /*stopAtAlias*/ false)
?.filter(d => toNormalizedPath(d.fileName) !== file);
if (some(jsDefinitions)) {
for (const jsDefinition of jsDefinitions) {
@@ -1288,7 +1291,7 @@ namespace ts.server {
const compilerOptions = project.getCompilationSettings();
const packageJson = getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), packageJsonCache, project, compilerOptions);
if (!packageJson) return undefined;
// Use fake options instead of actual compiler options to avoid following export map if the project uses node12 or nodenext -
// Use fake options instead of actual compiler options to avoid following export map if the project uses node16 or nodenext -
// Mapping from an export map entry across packages is out of scope for now. Returned entrypoints will only be what can be
// resolved from the package root under --moduleResolution node
const entrypoints = getEntrypointsFromPackageJsonInfo(
@@ -1330,7 +1333,7 @@ namespace ts.server {
if ((isStringLiteralLike(initialNode) || isIdentifier(initialNode)) && isAccessExpression(initialNode.parent)) {
return forEachNameInAccessChainWalkingLeft(initialNode, nameInChain => {
if (nameInChain === initialNode) return undefined;
const candidates = ls.getDefinitionAtPosition(file, nameInChain.getStart(), /*searchOtherFilesOnly*/ true)
const candidates = ls.getDefinitionAtPosition(file, nameInChain.getStart(), /*searchOtherFilesOnly*/ true, /*stopAtAlias*/ false)
?.filter(d => toNormalizedPath(d.fileName) !== file && d.isAmbient)
.map(d => ({
fileName: d.fileName,
+1 -1
View File
@@ -17,7 +17,7 @@ namespace ts.codefix {
Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined.code,
Diagnostics.Type_0_is_not_an_array_type.code,
Diagnostics.Type_0_is_not_an_array_type_or_a_string_type.code,
Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators.code,
Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher.code,
Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator.code,
Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator.code,
Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator.code,
@@ -2,8 +2,8 @@
namespace ts.codefix {
registerCodeFix({
errorCodes: [
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,
Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_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_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
],
getCodeActions: function getCodeActionsToFixModuleAndTarget(context) {
const compilerOptions = context.program.getCompilerOptions();
+1 -1
View File
@@ -864,7 +864,7 @@ namespace ts.codefix {
case ModuleKind.None:
// Fall back to the `import * as ns` style import.
return ImportKind.Namespace;
case ModuleKind.Node12:
case ModuleKind.Node16:
case ModuleKind.NodeNext:
return importingFile.impliedNodeFormat === ModuleKind.ESNext ? ImportKind.Namespace : ImportKind.CommonJS;
default:
+4 -4
View File
@@ -164,7 +164,7 @@ namespace ts.Completions {
TypeAssertionKeywords,
TypeKeywords,
TypeKeyword, // Literally just `type`
Last = TypeKeywords
Last = TypeKeyword
}
const enum GlobalsSearch { Continue, Success, Fail }
@@ -574,7 +574,7 @@ namespace ts.Completions {
if (keywordFilters !== KeywordCompletionFilters.None) {
const entryNames = new Set(entries.map(e => e.name));
for (const keywordEntry of getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile))) {
if (!entryNames.has(keywordEntry.name)) {
if (isTypeOnlyLocation && isTypeKeyword(stringToToken(keywordEntry.name)!) || !entryNames.has(keywordEntry.name)) {
insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
}
}
@@ -2761,7 +2761,7 @@ namespace ts.Completions {
}
// Do a relatively cheap check to bail early if all re-exports are non-importable
// due to file location or package.json dependency filtering. For non-node12+
// due to file location or package.json dependency filtering. For non-node16+
// module resolution modes, getting past this point guarantees that we'll be
// able to generate a suitable module specifier, so we can safely show a completion,
// even if we defer computing the module specifier.
@@ -2770,7 +2770,7 @@ namespace ts.Completions {
return;
}
// In node12+, module specifier resolution can fail due to modules being blocked
// In node16+, module specifier resolution can fail due to modules being blocked
// by package.json `exports`. If that happens, don't show a completion item.
// N.B. in this resolution mode we always try to resolve module specifiers here,
// because we have to know now if it's going to fail so we can omit the completion
+2 -2
View File
@@ -25,7 +25,7 @@ namespace ts {
* shape of a the resulting SourceFile. This allows the DocumentRegistry to store
* multiple copies of the same file for different compilation settings. A minimal
* resolution cache is needed to fully define a source file's shape when
* the compilation settings include `module: node12`+, so providing a cache host
* the compilation settings include `module: node16`+, so providing a cache host
* object should be preferred. A common host is a language service `ConfiguredProject`.
* @param scriptSnapshot Text of the file. Only used if the file was not found
* in the registry and a new one was created.
@@ -58,7 +58,7 @@ namespace ts {
* shape of a the resulting SourceFile. This allows the DocumentRegistry to store
* multiple copies of the same file for different compilation settings. A minimal
* resolution cache is needed to fully define a source file's shape when
* the compilation settings include `module: node12`+, so providing a cache host
* the compilation settings include `module: node16`+, so providing a cache host
* object should be preferred. A common host is a language service `ConfiguredProject`.
* @param scriptSnapshot Text of the file.
* @param version Current version of the file.
+7
View File
@@ -778,6 +778,13 @@ namespace ts.formatting {
let listDynamicIndentation = parentDynamicIndentation;
let startLine = parentStartLine;
// node range is outside the target range - do not dive inside
if (!rangeOverlapsWithStartEnd(originalRange, nodes.pos, nodes.end)) {
if (nodes.end < originalRange.pos) {
formattingScanner.skipToEndOf(nodes);
}
return;
}
if (listStartToken !== SyntaxKind.Unknown) {
// introduce a new indentation scope for lists (including list start and end tokens)
+2 -2
View File
@@ -12,7 +12,7 @@ namespace ts.formatting {
readEOFTokenRange(): TextRangeWithKind;
getCurrentLeadingTrivia(): TextRangeWithKind[] | undefined;
lastTrailingTriviaWasNewLine(): boolean;
skipToEndOf(node: Node): void;
skipToEndOf(node: Node | NodeArray<Node>): void;
skipToStartOf(node: Node): void;
}
@@ -286,7 +286,7 @@ namespace ts.formatting {
return tokenInfo;
}
function skipToEndOf(node: Node): void {
function skipToEndOf(node: Node | NodeArray<Node>): void {
scanner.setTextPos(node.end);
savedPos = scanner.getStartPos();
lastScanAction = undefined;
+7 -7
View File
@@ -1,6 +1,6 @@
/* @internal */
namespace ts.GoToDefinition {
export function getDefinitionAtPosition(program: Program, sourceFile: SourceFile, position: number, searchOtherFilesOnly?: boolean): readonly DefinitionInfo[] | undefined {
export function getDefinitionAtPosition(program: Program, sourceFile: SourceFile, position: number, searchOtherFilesOnly?: boolean, stopAtAlias?: boolean): readonly DefinitionInfo[] | undefined {
const resolvedRef = getReferenceAtPosition(sourceFile, position, program);
const fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || emptyArray;
if (resolvedRef?.file) {
@@ -28,7 +28,7 @@ namespace ts.GoToDefinition {
if (isStaticModifier(node) && isClassStaticBlockDeclaration(node.parent)) {
const classDecl = node.parent.parent;
const { symbol, failedAliasResolution } = getSymbol(classDecl, typeChecker);
const { symbol, failedAliasResolution } = getSymbol(classDecl, typeChecker, stopAtAlias);
const staticBlocks = filter(classDecl.members, isClassStaticBlockDeclaration);
const containerName = symbol ? typeChecker.symbolToString(symbol, classDecl) : "";
@@ -40,7 +40,7 @@ namespace ts.GoToDefinition {
});
}
let { symbol, failedAliasResolution } = getSymbol(node, typeChecker);
let { symbol, failedAliasResolution } = getSymbol(node, typeChecker, stopAtAlias);
let fallbackNode = node;
if (searchOtherFilesOnly && failedAliasResolution) {
@@ -48,7 +48,7 @@ namespace ts.GoToDefinition {
const importDeclaration = forEach([node, ...symbol?.declarations || emptyArray], n => findAncestor(n, isAnyImportOrBareOrAccessedRequire));
const moduleSpecifier = importDeclaration && tryGetModuleSpecifierFromDeclaration(importDeclaration);
if (moduleSpecifier) {
({ symbol, failedAliasResolution } = getSymbol(moduleSpecifier, typeChecker));
({ symbol, failedAliasResolution } = getSymbol(moduleSpecifier, typeChecker, stopAtAlias));
fallbackNode = moduleSpecifier;
}
}
@@ -235,7 +235,7 @@ namespace ts.GoToDefinition {
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent, /*failedAliasResolution*/ false);
}
const { symbol, failedAliasResolution } = getSymbol(node, typeChecker);
const { symbol, failedAliasResolution } = getSymbol(node, typeChecker, /*stopAtAlias*/ false);
if (!symbol) return undefined;
const typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
@@ -292,14 +292,14 @@ namespace ts.GoToDefinition {
return mapDefined(checker.getIndexInfosAtLocation(node), info => info.declaration && createDefinitionFromSignatureDeclaration(checker, info.declaration));
}
function getSymbol(node: Node, checker: TypeChecker) {
function getSymbol(node: Node, checker: TypeChecker, stopAtAlias: boolean | undefined) {
const symbol = checker.getSymbolAtLocation(node);
// If this is an alias, and the request came at the declaration location
// get the aliased symbol instead. This allows for goto def on an import e.g.
// import {A, B} from "mod";
// to jump to the implementation directly.
let failedAliasResolution = false;
if (symbol?.declarations && symbol.flags & SymbolFlags.Alias && shouldSkipAlias(node, symbol.declarations[0])) {
if (symbol?.declarations && symbol.flags & SymbolFlags.Alias && !stopAtAlias && shouldSkipAlias(node, symbol.declarations[0])) {
const aliased = checker.getAliasedSymbol(symbol);
if (aliased.declarations) {
return { symbol: aliased };
+2 -2
View File
@@ -1768,9 +1768,9 @@ namespace ts {
}
/// Goto definition
function getDefinitionAtPosition(fileName: string, position: number, searchOtherFilesOnly?: boolean): readonly DefinitionInfo[] | undefined {
function getDefinitionAtPosition(fileName: string, position: number, searchOtherFilesOnly?: boolean, stopAtAlias?: boolean): readonly DefinitionInfo[] | undefined {
synchronizeHostData();
return GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly);
return GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly, stopAtAlias);
}
function getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan | undefined {
+2 -2
View File
@@ -377,12 +377,12 @@ namespace ts.Completions.StringCompletions {
function isEmitResolutionKindUsingNodeModules(compilerOptions: CompilerOptions): boolean {
return getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.NodeJs ||
getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Node12 ||
getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Node16 ||
getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.NodeNext;
}
function isEmitModuleResolutionRespectingExportMaps(compilerOptions: CompilerOptions) {
return getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Node12 ||
return getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Node16 ||
getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.NodeNext;
}
+5 -2
View File
@@ -267,7 +267,7 @@ namespace ts {
/*
* Unlike `realpath and `readDirectory`, `readFile` and `fileExists` are now _required_
* to properly acquire and setup source files under module: node12+ modes.
* to properly acquire and setup source files under module: node16+ modes.
*/
readFile(path: string, encoding?: string): string | undefined;
fileExists(path: string): boolean;
@@ -474,7 +474,10 @@ namespace ts {
/*@internal*/
// eslint-disable-next-line @typescript-eslint/unified-signatures
getDefinitionAtPosition(fileName: string, position: number, searchOtherFilesOnly: boolean): readonly DefinitionInfo[] | undefined;
getDefinitionAtPosition(fileName: string, position: number, searchOtherFilesOnly: false, stopAtAlias: boolean): readonly DefinitionInfo[] | undefined;
/*@internal*/
// eslint-disable-next-line @typescript-eslint/unified-signatures
getDefinitionAtPosition(fileName: string, position: number, searchOtherFilesOnly: boolean, stopAtAlias: false): readonly DefinitionInfo[] | undefined;
getDefinitionAtPosition(fileName: string, position: number): readonly DefinitionInfo[] | undefined;
getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan | undefined;
getTypeDefinitionAtPosition(fileName: string, position: number): readonly DefinitionInfo[] | undefined;
+2 -2
View File
@@ -1929,11 +1929,11 @@ namespace ts {
}
export function moduleResolutionRespectsExports(moduleResolution: ModuleResolutionKind): boolean {
return moduleResolution >= ModuleResolutionKind.Node12 && moduleResolution <= ModuleResolutionKind.NodeNext;
return moduleResolution >= ModuleResolutionKind.Node16 && moduleResolution <= ModuleResolutionKind.NodeNext;
}
export function moduleResolutionUsesNodeModules(moduleResolution: ModuleResolutionKind): boolean {
return moduleResolution === ModuleResolutionKind.NodeJs || moduleResolution >= ModuleResolutionKind.Node12 && moduleResolution <= ModuleResolutionKind.NodeNext;
return moduleResolution === ModuleResolutionKind.NodeJs || moduleResolution >= ModuleResolutionKind.Node16 && moduleResolution <= ModuleResolutionKind.NodeNext;
}
export function makeImportIfNecessary(defaultImport: Identifier | undefined, namedImports: readonly ImportSpecifier[] | undefined, moduleSpecifier: string, quotePreference: QuotePreference): ImportDeclaration | undefined {
+1
View File
@@ -154,6 +154,7 @@
"unittests/tsc/incremental.ts",
"unittests/tsc/listFilesOnly.ts",
"unittests/tsc/projectReferences.ts",
"unittests/tsc/redirect.ts",
"unittests/tsc/runWithoutArgs.ts",
"unittests/tscWatch/consoleClearing.ts",
"unittests/tscWatch/emit.ts",
@@ -159,7 +159,7 @@ namespace ts {
start: undefined,
length: undefined,
}, {
messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node12', 'nodenext'.",
messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext'.",
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
@@ -237,7 +237,7 @@ namespace ts {
start: undefined,
length: undefined,
}, {
messageText: "Argument for '--moduleResolution' option must be: 'node', 'classic', 'node12', 'nodenext'.",
messageText: "Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'.",
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
@@ -89,7 +89,7 @@ namespace ts {
});
});
// https://github.com/microsoft/TypeScript/issues/44434 but with `module: node12`, some `exports` maps blocking direct access, and no `baseUrl`
// https://github.com/microsoft/TypeScript/issues/44434 but with `module: node16`, some `exports` maps blocking direct access, and no `baseUrl`
describe("unittests:: tsbuild:: moduleSpecifiers:: synthesized module specifiers across referenced projects resolve correctly", () => {
verifyTsc({
scenario: "moduleSpecifiers",
@@ -140,7 +140,7 @@ namespace ts {
{
"compilerOptions": {
"declaration": true,
"module": "node12"
"module": "node16"
}
}`,
"/src/src-types/package.json": Utils.dedent`
@@ -178,7 +178,7 @@ namespace ts {
}`,
}, ""),
modifyFs: fs => {
fs.writeFileSync("/lib/lib.es2020.full.d.ts", tscWatch.libFile.content);
fs.writeFileSync("/lib/lib.es2022.full.d.ts", tscWatch.libFile.content);
fs.symlinkSync("/src", "/src/src-types/node_modules");
fs.symlinkSync("/src", "/src/src-dogs/node_modules");
},
@@ -77,7 +77,7 @@ namespace ts.tscWatch {
content: JSON.stringify({
compilerOptions: {
outDir: "build",
module: "node12",
module: "node16",
},
references: [{ path: "../pkg2" }]
})
@@ -96,7 +96,7 @@ namespace ts.tscWatch {
compilerOptions: {
composite: true,
outDir: "build",
module: "node12",
module: "node16",
}
})
},
@@ -113,7 +113,7 @@ namespace ts.tscWatch {
path: `${projectRoot}/node_modules/pkg2`,
symLink: `${projectRoot}/packages/pkg2`,
},
{ ...libFile, path: `/a/lib/lib.es2020.full.d.ts` }
{ ...libFile, path: `/a/lib/lib.es2022.full.d.ts` }
], { currentDirectory: projectRoot }),
commandLineArgs: ["-b", "packages/pkg1", "-w", "--verbose", "--traceResolution"],
changes: [
+34
View File
@@ -0,0 +1,34 @@
namespace ts {
describe("unittests:: tsc:: redirect::", () => {
verifyTsc({
scenario: "redirect",
subScenario: "when redirecting ts file",
fs: () => loadProjectFromFiles({
"/src/project/tsconfig.json": JSON.stringify({
compilerOptions: {
outDir: "out"
},
include: [
"copy1/node_modules/target/*",
"copy2/node_modules/target/*",
]
}),
"/src/project/copy1/node_modules/target/index.ts": "export const a = 1;",
"/src/project/copy1/node_modules/target/import.ts": `import {} from "./";`,
"/src/project/copy1/node_modules/target/package.json": JSON.stringify({
name: "target",
version: "1.0.0",
main: "index.js",
}),
"/src/project/copy2/node_modules/target/index.ts": "export const a = 1;",
"/src/project/copy2/node_modules/target/import.ts": `import {} from "./";`,
"/src/project/copy2/node_modules/target/package.json": JSON.stringify({
name: "target",
version: "1.0.0",
main: "index.js",
}),
}),
commandLineArgs: ["-p", "src/project"],
});
});
}
@@ -1,4 +1,4 @@
tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck13.ts(4,19): error TS2569: Type 'Set<string>' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.
tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck13.ts(4,19): error TS2802: Type 'Set<string>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.
==== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck13.ts (1 errors) ====
@@ -7,4 +7,4 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck13.ts(4,19
strSet.add('World')
for (const str of strSet) { }
~~~~~~
!!! error TS2569: Type 'Set<string>' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.
!!! error TS2802: Type 'Set<string>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.
@@ -1,8 +1,8 @@
tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck14.ts(2,17): error TS2569: Type 'Set<number>' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.
tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck14.ts(2,17): error TS2802: Type 'Set<number>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.
==== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck14.ts (1 errors) ====
var union: string | Set<number>
for (const e of union) { }
~~~~~
!!! error TS2569: Type 'Set<number>' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.
!!! error TS2802: Type 'Set<number>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.
+7 -7
View File
@@ -2063,7 +2063,7 @@ declare namespace ts {
hasNoDefaultLib: boolean;
languageVersion: ScriptTarget;
/**
* When `module` is `Node12` or `NodeNext`, this field controls whether the
* When `module` is `Node16` or `NodeNext`, this field controls whether the
* source file in question is an ESNext-output-format file, or a CommonJS-output-format
* module. This is derived by the module resolver as it looks up the file, since
* it is derived from either the file extension of the module, or the containing
@@ -2893,7 +2893,7 @@ declare namespace ts {
export enum ModuleResolutionKind {
Classic = 1,
NodeJs = 2,
Node12 = 3,
Node16 = 3,
NodeNext = 99
}
export enum ModuleDetectionKind {
@@ -2902,7 +2902,7 @@ declare namespace ts {
*/
Legacy = 1,
/**
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution: node12+
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution: node16+
*/
Auto = 2,
/**
@@ -3074,7 +3074,7 @@ declare namespace ts {
ES2020 = 6,
ES2022 = 7,
ESNext = 99,
Node12 = 100,
Node16 = 100,
NodeNext = 199
}
export enum JsxEmit {
@@ -4818,7 +4818,7 @@ declare namespace ts {
/**
* Controls the format the file is detected as - this can be derived from only the path
* and files on disk, but needs to be done with a module resolution cache in scope to be performant.
* This is usually `undefined` for compilations that do not have `moduleResolution` values of `node12` or `nodenext`.
* This is usually `undefined` for compilations that do not have `moduleResolution` values of `node16` or `nodenext`.
*/
impliedNodeFormat?: ModuleKind.ESNext | ModuleKind.CommonJS;
/**
@@ -6822,7 +6822,7 @@ declare namespace ts {
* shape of a the resulting SourceFile. This allows the DocumentRegistry to store
* multiple copies of the same file for different compilation settings. A minimal
* resolution cache is needed to fully define a source file's shape when
* the compilation settings include `module: node12`+, so providing a cache host
* the compilation settings include `module: node16`+, so providing a cache host
* object should be preferred. A common host is a language service `ConfiguredProject`.
* @param scriptSnapshot Text of the file. Only used if the file was not found
* in the registry and a new one was created.
@@ -6841,7 +6841,7 @@ declare namespace ts {
* shape of a the resulting SourceFile. This allows the DocumentRegistry to store
* multiple copies of the same file for different compilation settings. A minimal
* resolution cache is needed to fully define a source file's shape when
* the compilation settings include `module: node12`+, so providing a cache host
* the compilation settings include `module: node16`+, so providing a cache host
* object should be preferred. A common host is a language service `ConfiguredProject`.
* @param scriptSnapshot Text of the file.
* @param version Current version of the file.
+7 -7
View File
@@ -2063,7 +2063,7 @@ declare namespace ts {
hasNoDefaultLib: boolean;
languageVersion: ScriptTarget;
/**
* When `module` is `Node12` or `NodeNext`, this field controls whether the
* When `module` is `Node16` or `NodeNext`, this field controls whether the
* source file in question is an ESNext-output-format file, or a CommonJS-output-format
* module. This is derived by the module resolver as it looks up the file, since
* it is derived from either the file extension of the module, or the containing
@@ -2893,7 +2893,7 @@ declare namespace ts {
export enum ModuleResolutionKind {
Classic = 1,
NodeJs = 2,
Node12 = 3,
Node16 = 3,
NodeNext = 99
}
export enum ModuleDetectionKind {
@@ -2902,7 +2902,7 @@ declare namespace ts {
*/
Legacy = 1,
/**
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution: node12+
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution: node16+
*/
Auto = 2,
/**
@@ -3074,7 +3074,7 @@ declare namespace ts {
ES2020 = 6,
ES2022 = 7,
ESNext = 99,
Node12 = 100,
Node16 = 100,
NodeNext = 199
}
export enum JsxEmit {
@@ -4818,7 +4818,7 @@ declare namespace ts {
/**
* Controls the format the file is detected as - this can be derived from only the path
* and files on disk, but needs to be done with a module resolution cache in scope to be performant.
* This is usually `undefined` for compilations that do not have `moduleResolution` values of `node12` or `nodenext`.
* This is usually `undefined` for compilations that do not have `moduleResolution` values of `node16` or `nodenext`.
*/
impliedNodeFormat?: ModuleKind.ESNext | ModuleKind.CommonJS;
/**
@@ -6822,7 +6822,7 @@ declare namespace ts {
* shape of a the resulting SourceFile. This allows the DocumentRegistry to store
* multiple copies of the same file for different compilation settings. A minimal
* resolution cache is needed to fully define a source file's shape when
* the compilation settings include `module: node12`+, so providing a cache host
* the compilation settings include `module: node16`+, so providing a cache host
* object should be preferred. A common host is a language service `ConfiguredProject`.
* @param scriptSnapshot Text of the file. Only used if the file was not found
* in the registry and a new one was created.
@@ -6841,7 +6841,7 @@ declare namespace ts {
* shape of a the resulting SourceFile. This allows the DocumentRegistry to store
* multiple copies of the same file for different compilation settings. A minimal
* resolution cache is needed to fully define a source file's shape when
* the compilation settings include `module: node12`+, so providing a cache host
* the compilation settings include `module: node16`+, so providing a cache host
* object should be preferred. A common host is a language service `ConfiguredProject`.
* @param scriptSnapshot Text of the file.
* @param version Current version of the file.
@@ -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 '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(39,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 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', 'node16', 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 'es2022', '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', 'node16', 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 'es2022', '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', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
@@ -1340,7 +1340,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -1453,7 +1453,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -2369,7 +2369,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -2482,7 +2482,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -9430,7 +9430,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -9543,7 +9543,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -14244,7 +14244,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -14357,7 +14357,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -21305,7 +21305,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -21418,7 +21418,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -25370,7 +25370,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -25483,7 +25483,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -30591,7 +30591,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -30704,7 +30704,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -34610,7 +34610,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -34723,7 +34723,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -39785,7 +39785,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -39898,7 +39898,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -45006,7 +45006,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -45119,7 +45119,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -50227,7 +50227,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -50340,7 +50340,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -55448,7 +55448,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -55561,7 +55561,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -59508,7 +59508,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -59621,7 +59621,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -63568,7 +63568,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -63681,7 +63681,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -67628,7 +67628,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -67741,7 +67741,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -71688,7 +71688,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -71801,7 +71801,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -75748,7 +75748,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -75861,7 +75861,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -79808,7 +79808,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -79921,7 +79921,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -84209,7 +84209,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -84322,7 +84322,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -89567,7 +89567,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -89680,7 +89680,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -94181,7 +94181,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -94294,7 +94294,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -3203,7 +3203,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -3316,7 +3316,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -8852,7 +8852,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -8965,7 +8965,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -15271,7 +15271,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -15384,7 +15384,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -20816,7 +20816,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -20929,7 +20929,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -26715,7 +26715,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -26828,7 +26828,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -32364,7 +32364,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -32477,7 +32477,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -38704,7 +38704,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -38817,7 +38817,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -1071,7 +1071,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -1184,7 +1184,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -5343,7 +5343,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -5456,7 +5456,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -8859,7 +8859,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -8972,7 +8972,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -1247,7 +1247,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -1360,7 +1360,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -5175,7 +5175,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -5288,7 +5288,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -9793,7 +9793,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -9906,7 +9906,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -13493,7 +13493,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI.",
"text": "A value representing an unencoded URI.",
"kind": "text"
}
]
@@ -13606,7 +13606,7 @@
"kind": "space"
},
{
"text": "A value representing an encoded URI component.",
"text": "A value representing an unencoded URI component.",
"kind": "text"
}
]
@@ -0,0 +1,334 @@
tests/cases/conformance/controlFlow/dependentDestructuredVariables.ts(314,5): error TS7022: 'value1' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
tests/cases/conformance/controlFlow/dependentDestructuredVariables.ts(314,5): error TS7031: Binding element 'value1' implicitly has an 'any' type.
==== tests/cases/conformance/controlFlow/dependentDestructuredVariables.ts (2 errors) ====
type Action =
| { kind: 'A', payload: number }
| { kind: 'B', payload: string };
function f10({ kind, payload }: Action) {
if (kind === 'A') {
payload.toFixed();
}
if (kind === 'B') {
payload.toUpperCase();
}
}
function f11(action: Action) {
const { kind, payload } = action;
if (kind === 'A') {
payload.toFixed();
}
if (kind === 'B') {
payload.toUpperCase();
}
}
function f12({ kind, payload }: Action) {
switch (kind) {
case 'A':
payload.toFixed();
break;
case 'B':
payload.toUpperCase();
break;
default:
payload; // never
}
}
type Action2 =
| { kind: 'A', payload: number | undefined }
| { kind: 'B', payload: string | undefined };
function f20({ kind, payload }: Action2) {
if (payload) {
if (kind === 'A') {
payload.toFixed();
}
if (kind === 'B') {
payload.toUpperCase();
}
}
}
function f21(action: Action2) {
const { kind, payload } = action;
if (payload) {
if (kind === 'A') {
payload.toFixed();
}
if (kind === 'B') {
payload.toUpperCase();
}
}
}
function f22(action: Action2) {
if (action.payload) {
const { kind, payload } = action;
if (kind === 'A') {
payload.toFixed();
}
if (kind === 'B') {
payload.toUpperCase();
}
}
}
function f23({ kind, payload }: Action2) {
if (payload) {
switch (kind) {
case 'A':
payload.toFixed();
break;
case 'B':
payload.toUpperCase();
break;
default:
payload; // never
}
}
}
type Foo =
| { kind: 'A', isA: true }
| { kind: 'B', isA: false }
| { kind: 'C', isA: false };
function f30({ kind, isA }: Foo) {
if (kind === 'A') {
isA; // true
}
if (kind === 'B') {
isA; // false
}
if (kind === 'C') {
isA; // false
}
if (isA) {
kind; // 'A'
}
else {
kind; // 'B' | 'C'
}
}
type Args = ['A', number] | ['B', string]
function f40(...[kind, data]: Args) {
if (kind === 'A') {
data.toFixed();
}
if (kind === 'B') {
data.toUpperCase();
}
}
// Repro from #35283
interface A<T> { variant: 'a', value: T }
interface B<T> { variant: 'b', value: Array<T> }
type AB<T> = A<T> | B<T>;
declare function printValue<T>(t: T): void;
declare function printValueList<T>(t: Array<T>): void;
function unrefined1<T>(ab: AB<T>): void {
const { variant, value } = ab;
if (variant === 'a') {
printValue<T>(value);
}
else {
printValueList<T>(value);
}
}
// Repro from #38020
type Action3 =
| {type: 'add', payload: { toAdd: number } }
| {type: 'remove', payload: { toRemove: number } };
const reducerBroken = (state: number, { type, payload }: Action3) => {
switch (type) {
case 'add':
return state + payload.toAdd;
case 'remove':
return state - payload.toRemove;
}
}
// Repro from #46143
declare var it: Iterator<number>;
const { value, done } = it.next();
if (!done) {
value; // number
}
// Repro from #46658
declare function f50(cb: (...args: Args) => void): void
f50((kind, data) => {
if (kind === 'A') {
data.toFixed();
}
if (kind === 'B') {
data.toUpperCase();
}
});
const f51: (...args: ['A', number] | ['B', string]) => void = (kind, payload) => {
if (kind === 'A') {
payload.toFixed();
}
if (kind === 'B') {
payload.toUpperCase();
}
};
const f52: (...args: ['A', number] | ['B']) => void = (kind, payload?) => {
if (kind === 'A') {
payload.toFixed();
}
else {
payload; // undefined
}
};
declare function readFile(path: string, callback: (...args: [err: null, data: unknown[]] | [err: Error, data: undefined]) => void): void;
readFile('hello', (err, data) => {
if (err === null) {
data.length;
}
else {
err.message;
}
});
type ReducerArgs = ["add", { a: number, b: number }] | ["concat", { firstArr: any[], secondArr: any[] }];
const reducer: (...args: ReducerArgs) => void = (op, args) => {
switch (op) {
case "add":
console.log(args.a + args.b);
break;
case "concat":
console.log(args.firstArr.concat(args.secondArr));
break;
}
}
reducer("add", { a: 1, b: 3 });
reducer("concat", { firstArr: [1, 2], secondArr: [3, 4] });
// repro from https://github.com/microsoft/TypeScript/pull/47190#issuecomment-1057603588
type FooMethod = {
method(...args:
[type: "str", cb: (e: string) => void] |
[type: "num", cb: (e: number) => void]
): void;
}
let fooM: FooMethod = {
method(type, cb) {
if (type == 'num') {
cb(123)
} else {
cb("abc")
}
}
};
type FooAsyncMethod = {
method(...args:
[type: "str", cb: (e: string) => void] |
[type: "num", cb: (e: number) => void]
): Promise<any>;
}
let fooAsyncM: FooAsyncMethod = {
async method(type, cb) {
if (type == 'num') {
cb(123)
} else {
cb("abc")
}
}
};
type FooGenMethod = {
method(...args:
[type: "str", cb: (e: string) => void] |
[type: "num", cb: (e: number) => void]
): Generator<any, any, any>;
}
let fooGenM: FooGenMethod = {
*method(type, cb) {
if (type == 'num') {
cb(123)
} else {
cb("abc")
}
}
};
type FooAsyncGenMethod = {
method(...args:
[type: "str", cb: (e: string) => void] |
[type: "num", cb: (e: number) => void]
): AsyncGenerator<any, any, any>;
}
let fooAsyncGenM: FooAsyncGenMethod = {
async *method(type, cb) {
if (type == 'num') {
cb(123)
} else {
cb("abc")
}
}
};
// Repro from #48345
type Func = <T extends ["a", number] | ["b", string]>(...args: T) => void;
const f60: Func = (kind, payload) => {
if (kind === "a") {
payload.toFixed(); // error
}
if (kind === "b") {
payload.toUpperCase(); // error
}
};
// Repro from #48902
function foo({
value1,
~~~~~~
!!! error TS7022: 'value1' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
~~~~~~
!!! error TS7031: Binding element 'value1' implicitly has an 'any' type.
test1 = value1.test1,
test2 = value1.test2,
test3 = value1.test3,
test4 = value1.test4,
test5 = value1.test5,
test6 = value1.test6,
test7 = value1.test7,
test8 = value1.test8,
test9 = value1.test9
}) {}
@@ -308,6 +308,21 @@ const f60: Func = (kind, payload) => {
payload.toUpperCase(); // error
}
};
// Repro from #48902
function foo({
value1,
test1 = value1.test1,
test2 = value1.test2,
test3 = value1.test3,
test4 = value1.test4,
test5 = value1.test5,
test6 = value1.test6,
test7 = value1.test7,
test8 = value1.test8,
test9 = value1.test9
}) {}
//// [dependentDestructuredVariables.js]
@@ -550,6 +565,8 @@ const f60 = (kind, payload) => {
payload.toUpperCase(); // error
}
};
// Repro from #48902
function foo({ value1, test1 = value1.test1, test2 = value1.test2, test3 = value1.test3, test4 = value1.test4, test5 = value1.test5, test6 = value1.test6, test7 = value1.test7, test8 = value1.test8, test9 = value1.test9 }) { }
//// [dependentDestructuredVariables.d.ts]
@@ -667,3 +684,15 @@ declare type FooAsyncGenMethod = {
declare let fooAsyncGenM: FooAsyncGenMethod;
declare type Func = <T extends ["a", number] | ["b", string]>(...args: T) => void;
declare const f60: Func;
declare function foo({ value1, test1, test2, test3, test4, test5, test6, test7, test8, test9 }: {
value1: any;
test1?: any;
test2?: any;
test3?: any;
test4?: any;
test5?: any;
test6?: any;
test7?: any;
test8?: any;
test9?: any;
}): void;
@@ -784,3 +784,49 @@ const f60: Func = (kind, payload) => {
}
};
// Repro from #48902
function foo({
>foo : Symbol(foo, Decl(dependentDestructuredVariables.ts, 308, 2))
value1,
>value1 : Symbol(value1, Decl(dependentDestructuredVariables.ts, 312, 14))
test1 = value1.test1,
>test1 : Symbol(test1, Decl(dependentDestructuredVariables.ts, 313, 11))
>value1 : Symbol(value1, Decl(dependentDestructuredVariables.ts, 312, 14))
test2 = value1.test2,
>test2 : Symbol(test2, Decl(dependentDestructuredVariables.ts, 314, 25))
>value1 : Symbol(value1, Decl(dependentDestructuredVariables.ts, 312, 14))
test3 = value1.test3,
>test3 : Symbol(test3, Decl(dependentDestructuredVariables.ts, 315, 25))
>value1 : Symbol(value1, Decl(dependentDestructuredVariables.ts, 312, 14))
test4 = value1.test4,
>test4 : Symbol(test4, Decl(dependentDestructuredVariables.ts, 316, 25))
>value1 : Symbol(value1, Decl(dependentDestructuredVariables.ts, 312, 14))
test5 = value1.test5,
>test5 : Symbol(test5, Decl(dependentDestructuredVariables.ts, 317, 25))
>value1 : Symbol(value1, Decl(dependentDestructuredVariables.ts, 312, 14))
test6 = value1.test6,
>test6 : Symbol(test6, Decl(dependentDestructuredVariables.ts, 318, 25))
>value1 : Symbol(value1, Decl(dependentDestructuredVariables.ts, 312, 14))
test7 = value1.test7,
>test7 : Symbol(test7, Decl(dependentDestructuredVariables.ts, 319, 25))
>value1 : Symbol(value1, Decl(dependentDestructuredVariables.ts, 312, 14))
test8 = value1.test8,
>test8 : Symbol(test8, Decl(dependentDestructuredVariables.ts, 320, 25))
>value1 : Symbol(value1, Decl(dependentDestructuredVariables.ts, 312, 14))
test9 = value1.test9
>test9 : Symbol(test9, Decl(dependentDestructuredVariables.ts, 321, 25))
>value1 : Symbol(value1, Decl(dependentDestructuredVariables.ts, 312, 14))
}) {}
@@ -891,3 +891,67 @@ const f60: Func = (kind, payload) => {
}
};
// Repro from #48902
function foo({
>foo : ({ value1, test1, test2, test3, test4, test5, test6, test7, test8, test9 }: { value1: any; test1?: any; test2?: any; test3?: any; test4?: any; test5?: any; test6?: any; test7?: any; test8?: any; test9?: any; }) => void
value1,
>value1 : any
test1 = value1.test1,
>test1 : any
>value1.test1 : any
>value1 : any
>test1 : any
test2 = value1.test2,
>test2 : any
>value1.test2 : any
>value1 : any
>test2 : any
test3 = value1.test3,
>test3 : any
>value1.test3 : any
>value1 : any
>test3 : any
test4 = value1.test4,
>test4 : any
>value1.test4 : any
>value1 : any
>test4 : any
test5 = value1.test5,
>test5 : any
>value1.test5 : any
>value1 : any
>test5 : any
test6 = value1.test6,
>test6 : any
>value1.test6 : any
>value1 : any
>test6 : any
test7 = value1.test7,
>test7 : any
>value1.test7 : any
>value1 : any
>test7 : any
test8 = value1.test8,
>test8 : any
>value1.test8 : any
>value1 : any
>test8 : any
test9 = value1.test9
>test9 : any
>value1.test9 : any
>value1 : any
>test9 : any
}) {}
@@ -0,0 +1,27 @@
//// [a.ts]
declare var dec: any, __decorate: any;
@dec export class A {
}
const o = { a: 1 };
const y = { ...o };
//// [a.js]
"use strict";
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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.A = void 0;
let A = class A {
};
A = __decorate([
dec
], A);
exports.A = A;
const o = { a: 1 };
const y = Object.assign({}, o);
@@ -1,10 +1,8 @@
tests/cases/compiler/genericUnboundedTypeParamAssignability.ts(2,5): error TS2339: Property 'toString' does not exist on type 'T'.
tests/cases/compiler/genericUnboundedTypeParamAssignability.ts(15,6): error TS2345: Argument of type 'T' is not assignable to parameter of type '{}'.
tests/cases/compiler/genericUnboundedTypeParamAssignability.ts(16,6): error TS2345: Argument of type 'T' is not assignable to parameter of type 'Record<string, any>'.
tests/cases/compiler/genericUnboundedTypeParamAssignability.ts(17,5): error TS2339: Property 'toString' does not exist on type 'T'.
==== tests/cases/compiler/genericUnboundedTypeParamAssignability.ts (4 errors) ====
==== tests/cases/compiler/genericUnboundedTypeParamAssignability.ts (2 errors) ====
function f1<T>(o: T) {
o.toString(); // error
~~~~~~~~
@@ -22,13 +20,7 @@ tests/cases/compiler/genericUnboundedTypeParamAssignability.ts(17,5): error TS23
function user<T>(t: T) {
f1(t);
f2(t); // error in strict, unbounded T doesn't satisfy the constraint
~
!!! error TS2345: Argument of type 'T' is not assignable to parameter of type '{}'.
!!! related TS2208 tests/cases/compiler/genericUnboundedTypeParamAssignability.ts:13:15: This type parameter probably needs an `extends object` constraint.
f3(t); // error in strict, unbounded T doesn't satisfy the constraint
~
!!! error TS2345: Argument of type 'T' is not assignable to parameter of type 'Record<string, any>'.
!!! related TS2208 tests/cases/compiler/genericUnboundedTypeParamAssignability.ts:13:15: This type parameter probably needs an `extends object` constraint.
t.toString(); // error, for the same reason as f1()
~~~~~~~~
!!! error TS2339: Property 'toString' does not exist on type 'T'.
@@ -3,14 +3,14 @@ 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' or 'nodenext'.
tests/cases/conformance/importAssertion/2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
tests/cases/conformance/importAssertion/2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(2,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(3,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(4,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(5,26): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(7,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(2,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(3,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(4,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(5,26): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(7,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(8,11): message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments
tests/cases/conformance/importAssertion/3.ts(9,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(10,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(9,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(10,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.
tests/cases/conformance/importAssertion/3.ts(10,52): error TS1009: Trailing comma not allowed.
@@ -49,29 +49,29 @@ tests/cases/conformance/importAssertion/3.ts(10,52): error TS1009: Trailing comm
const a = import('./0')
const b = import('./0', { assert: { type: "json" } })
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.
const d = import('./0', { assert: {} })
~~~~~~~~~~~~~~
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.
const dd = import('./0', {})
~~
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.
declare function foo(): any;
const e = import('./0', foo())
~~~~~
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.
const f = import()
~~~~~~~~
!!! message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments
const g = import('./0', {}, {})
~~
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.
const h = import('./0', { assert: { type: "json" }},)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.
~
!!! error TS1009: Trailing comma not allowed.
@@ -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' or 'nodenext'.
tests/cases/conformance/importAssertion/2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'.
tests/cases/conformance/importAssertion/2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext' 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/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', 'node16', 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', 'node16', 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', 'node16', 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', 'node16', 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', 'node16', 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', 'node16', 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', 'node16', 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', 'node16', 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', 'node16', 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', 'es2022', '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', 'node16', or 'nodenext'.
const b = import('./0', { assert: { type: "json" } })
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! 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', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 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', 'es2022', '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', 'node16', or 'nodenext'.
const d = import('./0', { assert: {} })
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! 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', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'.
const dd = import('./0', {})
~~~~~~~~~~~~~~~~~
!!! 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', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 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', 'es2022', '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', 'node16', or 'nodenext'.
const f = import()
~~~~~~~~
!!! 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', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'.
const g = import('./0', {}, {})
~~~~~~~~~~~~~~~~~~~~~
!!! 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', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'.
const h = import('./0', { assert: { type: "json" }},)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! 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', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 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', '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/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', 'node16', 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', 'node16', 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', 'node16', 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', 'es2022', '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', 'node16', or 'nodenext'.
var p1 = import("./0");
~~~~~~~~~~~~~
!!! 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', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 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', 'es2022', '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', 'node16', or 'nodenext'.
}
@@ -2,7 +2,7 @@ tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts(5,8):
tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts(7,17): error TS1325: Argument of dynamic import cannot be spread element.
tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts(8,12): message TS1450: Dynamic imports can only accept a module specifier and an optional assertion as arguments
tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts(9,19): error TS2307: Cannot find module 'pathToModule' or its corresponding type declarations.
tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts(9,35): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts(9,35): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.
tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts(9,35): error TS2559: Type '"secondModule"' has no properties in common with type 'ImportCallOptions'.
@@ -25,6 +25,6 @@ tests/cases/conformance/dynamicImport/importCallExpressionGrammarError.ts(9,35):
~~~~~~~~~~~~~~
!!! error TS2307: Cannot find module 'pathToModule' or its corresponding type declarations.
~~~~~~~~~~~~~~
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'.
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.
~~~~~~~~~~~~~~
!!! error TS2559: Type '"secondModule"' has no properties in common with type 'ImportCallOptions'.
@@ -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', '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/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', 'node16', 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', 'node16', 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', 'es2022', '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', 'node16', 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', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 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', '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/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', 'node16', 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', 'node16', 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', 'es2022', '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', 'node16', 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', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'.
}
@@ -1,5 +1,5 @@
tests/cases/conformance/dynamicImport/1.ts(2,10): error TS1326: Dynamic import cannot have type arguments.
tests/cases/conformance/dynamicImport/1.ts(3,10): error TS1326: Dynamic import cannot have type arguments.
tests/cases/conformance/dynamicImport/1.ts(2,10): error TS1326: This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.
tests/cases/conformance/dynamicImport/1.ts(3,10): error TS1326: This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.
==== tests/cases/conformance/dynamicImport/0.ts (0 errors) ====
@@ -9,7 +9,7 @@ tests/cases/conformance/dynamicImport/1.ts(3,10): error TS1326: Dynamic import c
"use strict"
var p1 = import<Promise<any>>("./0"); // error
~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1326: Dynamic import cannot have type arguments.
!!! error TS1326: This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.
var p2 = import<>("./0"); // error
~~~~~~~~~~~~~~~
!!! error TS1326: Dynamic import cannot have type arguments.
!!! error TS1326: This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.
@@ -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', 'es2022', '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', 'node16', 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', 'es2022', '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', 'node16', 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', '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(1,70): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'node16', 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', 'es2022', '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', 'node16', 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', '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(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'node16', 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', '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(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'node16', 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', 'es2022', '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', 'node16', 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', '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(1,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'node16', 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', 'es2022', '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', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.
export let y = import.metal;
~~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.
let globalB = import.metal;
~~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.
import.meta = foo;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'es2022', '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', 'node16', 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', 'es2022', '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', 'node16', 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', '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(1,70): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'node16', 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', 'es2022', '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', 'node16', 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', '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(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'node16', 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', '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(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'node16', 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', 'es2022', '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', 'node16', 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', '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(1,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'node16', 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', 'es2022', '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', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.
export let y = import.metal;
~~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.
let globalB = import.metal;
~~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.
import.meta = foo;
~~~~~~~~~~~
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 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', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.
!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.
@@ -0,0 +1,12 @@
tests/cases/conformance/types/import/importWithTypeArguments.ts(1,1): error TS1326: This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.
tests/cases/conformance/types/import/importWithTypeArguments.ts(2,11): error TS1326: This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.
==== tests/cases/conformance/types/import/importWithTypeArguments.ts (2 errors) ====
import<T>
~~~~~~~~~
!!! error TS1326: This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.
const a = import<string, number>
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1326: This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments.
@@ -0,0 +1,8 @@
//// [importWithTypeArguments.ts]
import<T>
const a = import<string, number>
//// [importWithTypeArguments.js]
import;
var a = (import);
@@ -0,0 +1,7 @@
=== tests/cases/conformance/types/import/importWithTypeArguments.ts ===
import<T>
>T : Symbol(T)
const a = import<string, number>
>a : Symbol(a, Decl(importWithTypeArguments.ts, 1, 5))
@@ -0,0 +1,5 @@
=== tests/cases/conformance/types/import/importWithTypeArguments.ts ===
import<T>
const a = import<string, number>
>a : any
+15 -15
View File
@@ -59,10 +59,10 @@
"text": "C",
"kind": "linkName",
"target": {
"fileName": "/jsdocLink3.ts",
"fileName": "/module1.ts",
"textSpan": {
"start": 0,
"length": 18
"start": 9,
"length": 1
}
}
},
@@ -87,10 +87,10 @@
"text": "C",
"kind": "linkName",
"target": {
"fileName": "/jsdocLink3.ts",
"fileName": "/module1.ts",
"textSpan": {
"start": 0,
"length": 18
"start": 9,
"length": 1
}
}
},
@@ -110,10 +110,10 @@
"text": "C()",
"kind": "linkName",
"target": {
"fileName": "/jsdocLink3.ts",
"fileName": "/module1.ts",
"textSpan": {
"start": 0,
"length": 18
"start": 9,
"length": 1
}
}
},
@@ -133,10 +133,10 @@
"text": "C",
"kind": "linkName",
"target": {
"fileName": "/jsdocLink3.ts",
"fileName": "/module1.ts",
"textSpan": {
"start": 0,
"length": 18
"start": 9,
"length": 1
}
}
},
@@ -181,10 +181,10 @@
"text": "C",
"kind": "linkName",
"target": {
"fileName": "/jsdocLink3.ts",
"fileName": "/module1.ts",
"textSpan": {
"start": 0,
"length": 18
"start": 9,
"length": 1
}
}
},
@@ -1,709 +0,0 @@
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(316,5): error TS2322: Type 'T' is not assignable to type '{}'.
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(317,5): error TS2322: Type 'T[keyof T]' is not assignable to type '{}'.
Type 'T[string] | T[number] | T[symbol]' is not assignable to type '{}'.
Type 'T[string]' is not assignable to type '{}'.
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(318,5): error TS2322: Type 'T[K]' is not assignable to type '{}'.
Type 'T[keyof T]' is not assignable to type '{}'.
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(323,5): error TS2322: Type 'T' is not assignable to type '{} | null | undefined'.
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(324,5): error TS2322: Type 'T[keyof T]' is not assignable to type '{} | null | undefined'.
Type 'T[string] | T[number] | T[symbol]' is not assignable to type '{} | null | undefined'.
Type 'T[string]' is not assignable to type '{} | null | undefined'.
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(325,5): error TS2322: Type 'T[K]' is not assignable to type '{} | null | undefined'.
Type 'T[keyof T]' is not assignable to type '{} | null | undefined'.
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(611,33): error TS2345: Argument of type 'T[K]' is not assignable to parameter of type '{} | null | undefined'.
Type 'T[keyof T]' is not assignable to type '{} | null | undefined'.
Type 'T[string] | T[number] | T[symbol]' is not assignable to type '{} | null | undefined'.
Type 'T[string]' is not assignable to type '{} | null | undefined'.
tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts(619,13): error TS2322: Type 'T[keyof T]' is not assignable to type '{} | null | undefined'.
Type 'T[string] | T[number] | T[symbol]' is not assignable to type '{} | null | undefined'.
Type 'T[string]' is not assignable to type '{} | null | undefined'.
==== tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts (8 errors) ====
class Shape {
name: string;
width: number;
height: number;
visible: boolean;
}
class TaggedShape extends Shape {
tag: string;
}
class Item {
name: string;
price: number;
}
class Options {
visible: "yes" | "no";
}
type Dictionary<T> = { [x: string]: T };
type NumericallyIndexed<T> = { [x: number]: T };
const enum E { A, B, C }
type K00 = keyof any; // string
type K01 = keyof string; // "toString" | "charAt" | ...
type K02 = keyof number; // "toString" | "toFixed" | "toExponential" | ...
type K03 = keyof boolean; // "valueOf"
type K04 = keyof void; // never
type K05 = keyof undefined; // never
type K06 = keyof null; // never
type K07 = keyof never; // string | number | symbol
type K08 = keyof unknown; // never
type K10 = keyof Shape; // "name" | "width" | "height" | "visible"
type K11 = keyof Shape[]; // "length" | "toString" | ...
type K12 = keyof Dictionary<Shape>; // string
type K13 = keyof {}; // never
type K14 = keyof Object; // "constructor" | "toString" | ...
type K15 = keyof E; // "toString" | "toFixed" | "toExponential" | ...
type K16 = keyof [string, number]; // "0" | "1" | "length" | "toString" | ...
type K17 = keyof (Shape | Item); // "name"
type K18 = keyof (Shape & Item); // "name" | "width" | "height" | "visible" | "price"
type K19 = keyof NumericallyIndexed<Shape> // never
type KeyOf<T> = keyof T;
type K20 = KeyOf<Shape>; // "name" | "width" | "height" | "visible"
type K21 = KeyOf<Dictionary<Shape>>; // string
type NAME = "name";
type WIDTH_OR_HEIGHT = "width" | "height";
type Q10 = Shape["name"]; // string
type Q11 = Shape["width" | "height"]; // number
type Q12 = Shape["name" | "visible"]; // string | boolean
type Q20 = Shape[NAME]; // string
type Q21 = Shape[WIDTH_OR_HEIGHT]; // number
type Q30 = [string, number][0]; // string
type Q31 = [string, number][1]; // number
type Q32 = [string, number][number]; // string | number
type Q33 = [string, number][E.A]; // string
type Q34 = [string, number][E.B]; // number
type Q35 = [string, number]["0"]; // string
type Q36 = [string, number]["1"]; // string
type Q40 = (Shape | Options)["visible"]; // boolean | "yes" | "no"
type Q41 = (Shape & Options)["visible"]; // true & "yes" | true & "no" | false & "yes" | false & "no"
type Q50 = Dictionary<Shape>["howdy"]; // Shape
type Q51 = Dictionary<Shape>[123]; // Shape
type Q52 = Dictionary<Shape>[E.B]; // Shape
declare let cond: boolean;
function getProperty<T, K extends keyof T>(obj: T, key: K) {
return obj[key];
}
function setProperty<T, K extends keyof T>(obj: T, key: K, value: T[K]) {
obj[key] = value;
}
function f10(shape: Shape) {
let name = getProperty(shape, "name"); // string
let widthOrHeight = getProperty(shape, cond ? "width" : "height"); // number
let nameOrVisible = getProperty(shape, cond ? "name" : "visible"); // string | boolean
setProperty(shape, "name", "rectangle");
setProperty(shape, cond ? "width" : "height", 10);
setProperty(shape, cond ? "name" : "visible", true); // Technically not safe
}
function f11(a: Shape[]) {
let len = getProperty(a, "length"); // number
setProperty(a, "length", len);
}
function f12(t: [Shape, boolean]) {
let len = getProperty(t, "length");
let s2 = getProperty(t, "0"); // Shape
let b2 = getProperty(t, "1"); // boolean
}
function f13(foo: any, bar: any) {
let x = getProperty(foo, "x"); // any
let y = getProperty(foo, "100"); // any
let z = getProperty(foo, bar); // any
}
class Component<PropType> {
props: PropType;
getProperty<K extends keyof PropType>(key: K) {
return this.props[key];
}
setProperty<K extends keyof PropType>(key: K, value: PropType[K]) {
this.props[key] = value;
}
}
function f20(component: Component<Shape>) {
let name = component.getProperty("name"); // string
let widthOrHeight = component.getProperty(cond ? "width" : "height"); // number
let nameOrVisible = component.getProperty(cond ? "name" : "visible"); // string | boolean
component.setProperty("name", "rectangle");
component.setProperty(cond ? "width" : "height", 10)
component.setProperty(cond ? "name" : "visible", true); // Technically not safe
}
function pluck<T, K extends keyof T>(array: T[], key: K) {
return array.map(x => x[key]);
}
function f30(shapes: Shape[]) {
let names = pluck(shapes, "name"); // string[]
let widths = pluck(shapes, "width"); // number[]
let nameOrVisibles = pluck(shapes, cond ? "name" : "visible"); // (string | boolean)[]
}
function f31<K extends keyof Shape>(key: K) {
const shape: Shape = { name: "foo", width: 5, height: 10, visible: true };
return shape[key]; // Shape[K]
}
function f32<K extends "width" | "height">(key: K) {
const shape: Shape = { name: "foo", width: 5, height: 10, visible: true };
return shape[key]; // Shape[K]
}
function f33<S extends Shape, K extends keyof S>(shape: S, key: K) {
let name = getProperty(shape, "name");
let prop = getProperty(shape, key);
return prop;
}
function f34(ts: TaggedShape) {
let tag1 = f33(ts, "tag");
let tag2 = getProperty(ts, "tag");
}
class C {
public x: string;
protected y: string;
private z: string;
}
// Indexed access expressions have always permitted access to private and protected members.
// For consistency we also permit such access in indexed access types.
function f40(c: C) {
type X = C["x"];
type Y = C["y"];
type Z = C["z"];
let x: X = c["x"];
let y: Y = c["y"];
let z: Z = c["z"];
}
function f50<T>(k: keyof T, s: string) {
const x1 = s as keyof T;
const x2 = k as string;
}
function f51<T, K extends keyof T>(k: K, s: string) {
const x1 = s as keyof T;
const x2 = k as string;
}
function f52<T>(obj: { [x: string]: boolean }, k: Exclude<keyof T, symbol>, s: string, n: number) {
const x1 = obj[s];
const x2 = obj[n];
const x3 = obj[k];
}
function f53<T, K extends Exclude<keyof T, symbol>>(obj: { [x: string]: boolean }, k: K, s: string, n: number) {
const x1 = obj[s];
const x2 = obj[n];
const x3 = obj[k];
}
function f54<T>(obj: T, key: keyof T) {
for (let s in obj[key]) {
}
const b = "foo" in obj[key];
}
function f55<T, K extends keyof T>(obj: T, key: K) {
for (let s in obj[key]) {
}
const b = "foo" in obj[key];
}
function f60<T>(source: T, target: T) {
for (let k in source) {
target[k] = source[k];
}
}
function f70(func: <T, U>(k1: keyof (T | U), k2: keyof (T & U)) => void) {
func<{ a: any, b: any }, { a: any, c: any }>('a', 'a');
func<{ a: any, b: any }, { a: any, c: any }>('a', 'b');
func<{ a: any, b: any }, { a: any, c: any }>('a', 'c');
}
function f71(func: <T, U>(x: T, y: U) => Partial<T & U>) {
let x = func({ a: 1, b: "hello" }, { c: true });
x.a; // number | undefined
x.b; // string | undefined
x.c; // boolean | undefined
}
function f72(func: <T, U, K extends keyof T | keyof U>(x: T, y: U, k: K) => (T & U)[K]) {
let a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number
let b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string
let c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean
}
function f73(func: <T, U, K extends keyof (T & U)>(x: T, y: U, k: K) => (T & U)[K]) {
let a = func({ a: 1, b: "hello" }, { c: true }, 'a'); // number
let b = func({ a: 1, b: "hello" }, { c: true }, 'b'); // string
let c = func({ a: 1, b: "hello" }, { c: true }, 'c'); // boolean
}
function f74(func: <T, U, K extends keyof (T | U)>(x: T, y: U, k: K) => (T | U)[K]) {
let a = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'a'); // number
let b = func({ a: 1, b: "hello" }, { a: 2, b: true }, 'b'); // string | boolean
}
function f80<T extends { a: { x: any } }>(obj: T) {
let a1 = obj.a; // { x: any }
let a2 = obj['a']; // { x: any }
let a3 = obj['a'] as T['a']; // T["a"]
let x1 = obj.a.x; // any
let x2 = obj['a']['x']; // any
let x3 = obj['a']['x'] as T['a']['x']; // T["a"]["x"]
}
function f81<T extends { a: { x: any } }>(obj: T) {
return obj['a']['x'] as T['a']['x'];
}
function f82() {
let x1 = f81({ a: { x: "hello" } }); // string
let x2 = f81({ a: { x: 42 } }); // number
}
function f83<T extends { [x: string]: { x: any } }, K extends keyof T>(obj: T, key: K) {
return obj[key]['x'] as T[K]['x'];
}
function f84() {
let x1 = f83({ foo: { x: "hello" } }, "foo"); // string
let x2 = f83({ bar: { x: 42 } }, "bar"); // number
}
class C1 {
x: number;
get<K extends keyof this>(key: K) {
return this[key];
}
set<K extends keyof this>(key: K, value: this[K]) {
this[key] = value;
}
foo() {
let x1 = this.x; // number
let x2 = this["x"]; // number
let x3 = this.get("x"); // this["x"]
let x4 = getProperty(this, "x"); // this["x"]
this.x = 42;
this["x"] = 42;
this.set("x", 42);
setProperty(this, "x", 42);
}
}
type S2 = {
a: string;
b: string;
};
function f90<T extends S2, K extends keyof S2>(x1: S2[keyof S2], x2: T[keyof S2], x3: S2[K]) {
x1 = x2;
x1 = x3;
x2 = x1;
x2 = x3;
x3 = x1;
x3 = x2;
x1.length;
x2.length;
x3.length;
}
function f91<T, K extends keyof T>(x: T, y: T[keyof T], z: T[K]) {
let a: {};
a = x;
~
!!! error TS2322: Type 'T' is not assignable to type '{}'.
!!! related TS2208 tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts:314:14: This type parameter probably needs an `extends object` constraint.
a = y;
~
!!! error TS2322: Type 'T[keyof T]' is not assignable to type '{}'.
!!! error TS2322: Type 'T[string] | T[number] | T[symbol]' is not assignable to type '{}'.
!!! error TS2322: Type 'T[string]' is not assignable to type '{}'.
a = z;
~
!!! error TS2322: Type 'T[K]' is not assignable to type '{}'.
!!! error TS2322: Type 'T[keyof T]' is not assignable to type '{}'.
}
function f92<T, K extends keyof T>(x: T, y: T[keyof T], z: T[K]) {
let a: {} | null | undefined;
a = x;
~
!!! error TS2322: Type 'T' is not assignable to type '{} | null | undefined'.
!!! related TS2208 tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts:321:14: This type parameter probably needs an `extends object` constraint.
a = y;
~
!!! error TS2322: Type 'T[keyof T]' is not assignable to type '{} | null | undefined'.
!!! error TS2322: Type 'T[string] | T[number] | T[symbol]' is not assignable to type '{} | null | undefined'.
!!! error TS2322: Type 'T[string]' is not assignable to type '{} | null | undefined'.
a = z;
~
!!! error TS2322: Type 'T[K]' is not assignable to type '{} | null | undefined'.
!!! error TS2322: Type 'T[keyof T]' is not assignable to type '{} | null | undefined'.
}
// Repros from #12011
class Base {
get<K extends keyof this>(prop: K) {
return this[prop];
}
set<K extends keyof this>(prop: K, value: this[K]) {
this[prop] = value;
}
}
class Person extends Base {
parts: number;
constructor(parts: number) {
super();
this.set("parts", parts);
}
getParts() {
return this.get("parts")
}
}
class OtherPerson {
parts: number;
constructor(parts: number) {
setProperty(this, "parts", parts);
}
getParts() {
return getProperty(this, "parts")
}
}
// Modified repro from #12544
function path<T, K1 extends keyof T>(obj: T, key1: K1): T[K1];
function path<T, K1 extends keyof T, K2 extends keyof T[K1]>(obj: T, key1: K1, key2: K2): T[K1][K2];
function path<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]>(obj: T, key1: K1, key2: K2, key3: K3): T[K1][K2][K3];
function path(obj: any, ...keys: (string | number)[]): any;
function path(obj: any, ...keys: (string | number)[]): any {
let result = obj;
for (let k of keys) {
result = result[k];
}
return result;
}
type Thing = {
a: { x: number, y: string },
b: boolean
};
function f1(thing: Thing) {
let x1 = path(thing, 'a'); // { x: number, y: string }
let x2 = path(thing, 'a', 'y'); // string
let x3 = path(thing, 'b'); // boolean
let x4 = path(thing, ...['a', 'x']); // any
}
// Repro from comment in #12114
const assignTo2 = <T, K1 extends keyof T, K2 extends keyof T[K1]>(object: T, key1: K1, key2: K2) =>
(value: T[K1][K2]) => object[key1][key2] = value;
// Modified repro from #12573
declare function one<T>(handler: (t: T) => void): T
var empty = one(() => {}) // inferred as {}, expected
type Handlers<T> = { [K in keyof T]: (t: T[K]) => void }
declare function on<T>(handlerHash: Handlers<T>): T
var hashOfEmpty1 = on({ test: () => {} }); // {}
var hashOfEmpty2 = on({ test: (x: boolean) => {} }); // { test: boolean }
// Repro from #12624
interface Options1<Data, Computed> {
data?: Data
computed?: Computed;
}
declare class Component1<Data, Computed> {
constructor(options: Options1<Data, Computed>);
get<K extends keyof (Data & Computed)>(key: K): (Data & Computed)[K];
}
let c1 = new Component1({
data: {
hello: ""
}
});
c1.get("hello");
// Repro from #12625
interface Options2<Data, Computed> {
data?: Data
computed?: Computed;
}
declare class Component2<Data, Computed> {
constructor(options: Options2<Data, Computed>);
get<K extends keyof Data | keyof Computed>(key: K): (Data & Computed)[K];
}
// Repro from #12641
interface R {
p: number;
}
function f<K extends keyof R>(p: K) {
let a: any;
a[p].add; // any
}
// Repro from #12651
type MethodDescriptor = {
name: string;
args: any[];
returnValue: any;
}
declare function dispatchMethod<M extends MethodDescriptor>(name: M['name'], args: M['args']): M['returnValue'];
type SomeMethodDescriptor = {
name: "someMethod";
args: [string, number];
returnValue: string[];
}
let result = dispatchMethod<SomeMethodDescriptor>("someMethod", ["hello", 35]);
// Repro from #13073
type KeyTypes = "a" | "b"
let MyThingy: { [key in KeyTypes]: string[] };
function addToMyThingy<S extends KeyTypes>(key: S) {
MyThingy[key].push("a");
}
// Repro from #13102
type Handler<T> = {
onChange: (name: keyof T) => void;
};
function onChangeGenericFunction<T>(handler: Handler<T & {preset: number}>) {
handler.onChange('preset')
}
// Repro from #13285
function updateIds<T extends Record<K, string>, K extends string>(
obj: T,
idFields: K[],
idMapping: Partial<Record<T[K], T[K]>>
): Record<K, string> {
for (const idField of idFields) {
const newId: T[K] | undefined = idMapping[obj[idField]];
if (newId) {
obj[idField] = newId;
}
}
return obj;
}
// Repro from #13285
function updateIds2<T extends { [x: string]: string }, K extends keyof T>(
obj: T,
key: K,
stringMap: { [oldId: string]: string }
) {
var x = obj[key];
stringMap[x]; // Should be OK.
}
// Repro from #13514
declare function head<T extends Array<any>>(list: T): T[0];
// Repro from #13604
class A<T> {
props: T & { foo: string };
}
class B extends A<{ x: number}> {
f(p: this["props"]) {
p.x;
}
}
// Repro from #13749
class Form<T> {
private childFormFactories: {[K in keyof T]: (v: T[K]) => Form<T[K]>}
public set<K extends keyof T>(prop: K, value: T[K]) {
this.childFormFactories[prop](value)
}
}
// Repro from #13787
class SampleClass<P> {
public props: Readonly<P>;
constructor(props: P) {
this.props = Object.freeze(props);
}
}
interface Foo {
foo: string;
}
declare function merge<T, U>(obj1: T, obj2: U): T & U;
class AnotherSampleClass<T> extends SampleClass<T & Foo> {
constructor(props: T) {
const foo: Foo = { foo: "bar" };
super(merge(props, foo));
}
public brokenMethod() {
this.props.foo.concat;
}
}
new AnotherSampleClass({});
// Positive repro from #17166
function f3<T, K extends Extract<keyof T, string>>(t: T, k: K, tk: T[K]): void {
for (let key in t) {
key = k // ok, K ==> keyof T
t[key] = tk; // ok, T[K] ==> T[keyof T]
}
}
// # 21185
type Predicates<TaggedRecord> = {
[T in keyof TaggedRecord]: (variant: TaggedRecord[keyof TaggedRecord]) => variant is TaggedRecord[T]
}
// Repros from #23592
type Example<T extends { [K in keyof T]: { prop: any } }> = { [K in keyof T]: T[K]["prop"] };
type Result = Example<{ a: { prop: string }; b: { prop: number } }>;
type Helper2<T> = { [K in keyof T]: Extract<T[K], { prop: any }> };
type Example2<T> = { [K in keyof Helper2<T>]: Helper2<T>[K]["prop"] };
type Result2 = Example2<{ 1: { prop: string }; 2: { prop: number } }>;
// Repro from #23618
type DBBoolTable<K extends string> = { [k in K]: 0 | 1 }
enum Flag {
FLAG_1 = "flag_1",
FLAG_2 = "flag_2"
}
type SimpleDBRecord<Flag extends string> = { staticField: number } & DBBoolTable<Flag>
function getFlagsFromSimpleRecord<Flag extends string>(record: SimpleDBRecord<Flag>, flags: Flag[]) {
return record[flags[0]];
}
type DynamicDBRecord<Flag extends string> = ({ dynamicField: number } | { dynamicField: string }) & DBBoolTable<Flag>
function getFlagsFromDynamicRecord<Flag extends string>(record: DynamicDBRecord<Flag>, flags: Flag[]) {
return record[flags[0]];
}
// Repro from #21368
interface I {
foo: string;
}
declare function take<T>(p: T): void;
function fn<T extends I, K extends keyof T>(o: T, k: K) {
take<{} | null | undefined>(o[k]);
~~~~
!!! error TS2345: Argument of type 'T[K]' is not assignable to parameter of type '{} | null | undefined'.
!!! error TS2345: Type 'T[keyof T]' is not assignable to type '{} | null | undefined'.
!!! error TS2345: Type 'T[string] | T[number] | T[symbol]' is not assignable to type '{} | null | undefined'.
!!! error TS2345: Type 'T[string]' is not assignable to type '{} | null | undefined'.
take<any>(o[k]);
}
// Repro from #23133
class Unbounded<T> {
foo(x: T[keyof T]) {
let y: {} | undefined | null = x;
~
!!! error TS2322: Type 'T[keyof T]' is not assignable to type '{} | null | undefined'.
!!! error TS2322: Type 'T[string] | T[number] | T[symbol]' is not assignable to type '{} | null | undefined'.
!!! error TS2322: Type 'T[string]' is not assignable to type '{} | null | undefined'.
}
}
// Repro from #23940
interface I7 {
x: any;
}
type Foo7<T extends number> = T;
declare function f7<K extends keyof I7>(type: K): Foo7<I7[K]>;
// Repro from #21770
type Dict<T extends string> = { [key in T]: number };
type DictDict<V extends string, T extends string> = { [key in V]: Dict<T> };
function ff1<V extends string, T extends string>(dd: DictDict<V, T>, k1: V, k2: T): number {
return dd[k1][k2];
}
function ff2<V extends string, T extends string>(dd: DictDict<V, T>, k1: V, k2: T): number {
const d: Dict<T> = dd[k1];
return d[k2];
}
// Repro from #26409
const cf1 = <T extends { [P in K]: string; } & { cool: string; }, K extends keyof T>(t: T, k: K) =>
{
const s: string = t[k];
t.cool;
};
const cf2 = <T extends { [P in K | "cool"]: string; }, K extends keyof T>(t: T, k: K) =>
{
const s: string = t[k];
t.cool;
};
@@ -1,54 +0,0 @@
tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts(25,11): error TS2430: Interface 'E1<T>' incorrectly extends interface 'Base'.
Types of property 'foo' are incompatible.
Type 'T' is not assignable to type '{ [key: string]: any; }'.
==== tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts (1 errors) ====
function f1<T>(x: Partial<T>, y: Readonly<T>) {
let obj: {};
obj = x;
obj = y;
}
function f2<T>(x: Partial<T>, y: Readonly<T>) {
let obj: { [x: string]: any };
obj = x;
obj = y;
}
function f3<T>(x: Partial<T>) {
x = {};
}
// Repro from #12900
interface Base {
foo: { [key: string]: any };
bar: any;
baz: any;
}
interface E1<T> extends Base {
~~
!!! error TS2430: Interface 'E1<T>' incorrectly extends interface 'Base'.
!!! error TS2430: Types of property 'foo' are incompatible.
!!! error TS2430: Type 'T' is not assignable to type '{ [key: string]: any; }'.
!!! related TS2208 tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts:25:14: This type parameter probably needs an `extends object` constraint.
foo: T;
}
interface Something { name: string, value: string };
interface E2 extends Base {
foo: Partial<Something>; // or other mapped type
}
interface E3<T> extends Base {
foo: Partial<T>; // or other mapped type
}
// Repro from #13747
class Form<T> {
private values: {[P in keyof T]?: T[P]} = {}
}
@@ -0,0 +1,19 @@
//// [tests/cases/compiler/moduleResolutionWithModule.ts] ////
//// [package.json]
{
"name": "pkg",
"version": "0.0.1",
"exports": "./entrypoint.js"
}
//// [entrypoint.d.ts]
export declare function thing(): void;
//// [index.ts]
import * as p from "pkg";
p.thing();
//// [index.js]
"use strict";
exports.__esModule = true;
var p = require("pkg");
p.thing();
@@ -0,0 +1,13 @@
=== tests/cases/compiler/node_modules/pkg/entrypoint.d.ts ===
export declare function thing(): void;
>thing : Symbol(thing, Decl(entrypoint.d.ts, 0, 0))
=== tests/cases/compiler/index.ts ===
import * as p from "pkg";
>p : Symbol(p, Decl(index.ts, 0, 6))
p.thing();
>p.thing : Symbol(p.thing, Decl(entrypoint.d.ts, 0, 0))
>p : Symbol(p, Decl(index.ts, 0, 6))
>thing : Symbol(p.thing, Decl(entrypoint.d.ts, 0, 0))
@@ -0,0 +1,14 @@
=== tests/cases/compiler/node_modules/pkg/entrypoint.d.ts ===
export declare function thing(): void;
>thing : () => void
=== tests/cases/compiler/index.ts ===
import * as p from "pkg";
>p : typeof p
p.thing();
>p.thing() : void
>p.thing : () => void
>p : typeof p
>thing : () => void
@@ -0,0 +1,16 @@
tests/cases/compiler/index.ts(1,20): error TS2307: Cannot find module 'pkg' or its corresponding type declarations.
==== tests/cases/compiler/node_modules/pkg/package.json (0 errors) ====
{
"name": "pkg",
"version": "0.0.1",
"exports": "./entrypoint.js"
}
==== tests/cases/compiler/node_modules/pkg/entrypoint.d.ts (0 errors) ====
export declare function thing(): void;
==== tests/cases/compiler/index.ts (1 errors) ====
import * as p from "pkg";
~~~~~
!!! error TS2307: Cannot find module 'pkg' or its corresponding type declarations.
p.thing();
@@ -0,0 +1,42 @@
//// [tests/cases/compiler/moduleResolutionWithModule.ts] ////
//// [package.json]
{
"name": "pkg",
"version": "0.0.1",
"exports": "./entrypoint.js"
}
//// [entrypoint.d.ts]
export declare function thing(): void;
//// [index.ts]
import * as p from "pkg";
p.thing();
//// [index.js]
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const p = __importStar(require("pkg"));
p.thing();
@@ -0,0 +1,11 @@
=== tests/cases/compiler/node_modules/pkg/entrypoint.d.ts ===
export declare function thing(): void;
>thing : Symbol(thing, Decl(entrypoint.d.ts, 0, 0))
=== tests/cases/compiler/index.ts ===
import * as p from "pkg";
>p : Symbol(p, Decl(index.ts, 0, 6))
p.thing();
>p : Symbol(p, Decl(index.ts, 0, 6))
@@ -0,0 +1,14 @@
=== tests/cases/compiler/node_modules/pkg/entrypoint.d.ts ===
export declare function thing(): void;
>thing : () => void
=== tests/cases/compiler/index.ts ===
import * as p from "pkg";
>p : any
p.thing();
>p.thing() : any
>p.thing : any
>p : any
>thing : any
@@ -0,0 +1,42 @@
//// [tests/cases/compiler/moduleResolutionWithModule.ts] ////
//// [package.json]
{
"name": "pkg",
"version": "0.0.1",
"exports": "./entrypoint.js"
}
//// [entrypoint.d.ts]
export declare function thing(): void;
//// [index.ts]
import * as p from "pkg";
p.thing();
//// [index.js]
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const p = __importStar(require("pkg"));
p.thing();
@@ -0,0 +1,13 @@
=== tests/cases/compiler/node_modules/pkg/entrypoint.d.ts ===
export declare function thing(): void;
>thing : Symbol(thing, Decl(entrypoint.d.ts, 0, 0))
=== tests/cases/compiler/index.ts ===
import * as p from "pkg";
>p : Symbol(p, Decl(index.ts, 0, 6))
p.thing();
>p.thing : Symbol(p.thing, Decl(entrypoint.d.ts, 0, 0))
>p : Symbol(p, Decl(index.ts, 0, 6))
>thing : Symbol(p.thing, Decl(entrypoint.d.ts, 0, 0))
@@ -0,0 +1,14 @@
=== tests/cases/compiler/node_modules/pkg/entrypoint.d.ts ===
export declare function thing(): void;
>thing : () => void
=== tests/cases/compiler/index.ts ===
import * as p from "pkg";
>p : typeof p
p.thing();
>p.thing() : void
>p.thing : () => void
>p : typeof p
>thing : () => void
@@ -0,0 +1,42 @@
//// [tests/cases/compiler/moduleResolutionWithModule.ts] ////
//// [package.json]
{
"name": "pkg",
"version": "0.0.1",
"exports": "./entrypoint.js"
}
//// [entrypoint.d.ts]
export declare function thing(): void;
//// [index.ts]
import * as p from "pkg";
p.thing();
//// [index.js]
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const p = __importStar(require("pkg"));
p.thing();
@@ -0,0 +1,13 @@
=== tests/cases/compiler/node_modules/pkg/entrypoint.d.ts ===
export declare function thing(): void;
>thing : Symbol(thing, Decl(entrypoint.d.ts, 0, 0))
=== tests/cases/compiler/index.ts ===
import * as p from "pkg";
>p : Symbol(p, Decl(index.ts, 0, 6))
p.thing();
>p.thing : Symbol(p.thing, Decl(entrypoint.d.ts, 0, 0))
>p : Symbol(p, Decl(index.ts, 0, 6))
>thing : Symbol(p.thing, Decl(entrypoint.d.ts, 0, 0))
@@ -0,0 +1,14 @@
=== tests/cases/compiler/node_modules/pkg/entrypoint.d.ts ===
export declare function thing(): void;
>thing : () => void
=== tests/cases/compiler/index.ts ===
import * as p from "pkg";
>p : typeof p
p.thing();
>p.thing() : void
>p.thing : () => void
>p : typeof p
>thing : () => void
@@ -0,0 +1,42 @@
//// [tests/cases/compiler/moduleResolutionWithModule.ts] ////
//// [package.json]
{
"name": "pkg",
"version": "0.0.1",
"exports": "./entrypoint.js"
}
//// [entrypoint.d.ts]
export declare function thing(): void;
//// [index.ts]
import * as p from "pkg";
p.thing();
//// [index.js]
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const p = __importStar(require("pkg"));
p.thing();
@@ -0,0 +1,13 @@
=== tests/cases/compiler/node_modules/pkg/entrypoint.d.ts ===
export declare function thing(): void;
>thing : Symbol(thing, Decl(entrypoint.d.ts, 0, 0))
=== tests/cases/compiler/index.ts ===
import * as p from "pkg";
>p : Symbol(p, Decl(index.ts, 0, 6))
p.thing();
>p.thing : Symbol(p.thing, Decl(entrypoint.d.ts, 0, 0))
>p : Symbol(p, Decl(index.ts, 0, 6))
>thing : Symbol(p.thing, Decl(entrypoint.d.ts, 0, 0))
@@ -0,0 +1,14 @@
=== tests/cases/compiler/node_modules/pkg/entrypoint.d.ts ===
export declare function thing(): void;
>thing : () => void
=== tests/cases/compiler/index.ts ===
import * as p from "pkg";
>p : typeof p
p.thing();
>p.thing() : void
>p.thing : () => void
>p : typeof p
>thing : () => void
@@ -1,5 +1,5 @@
/src/bar.mts(2,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './foo.mjs'?
/src/bar.mts(3,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path.
/src/bar.mts(2,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './foo.mjs'?
/src/bar.mts(3,21): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.
==== /src/foo.mts (0 errors) ====
@@ -11,8 +11,8 @@
// Extensionless relative path ES import in an ES module
import { foo } from "./foo"; // should error, suggest adding ".mjs"
~~~~~~~
!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './foo.mjs'?
!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './foo.mjs'?
import { baz } from "./baz"; // should error, ask for extension, no extension suggestion
~~~~~~~
!!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path.
!!! error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.
@@ -1,4 +1,4 @@
/src/bar.mts(2,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './foo.jsx'?
/src/bar.mts(2,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './foo.jsx'?
==== /src/foo.tsx (0 errors) ====
@@ -10,5 +10,5 @@
// Extensionless relative path ES import in an ES module
import { foo } from "./foo"; // should error, suggest adding ".jsx"
~~~~~~~
!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './foo.jsx'?
!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './foo.jsx'?
@@ -1,4 +1,4 @@
/src/bar.mts(2,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './foo.js'?
/src/bar.mts(2,21): error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './foo.js'?
==== /src/foo.tsx (0 errors) ====
@@ -10,5 +10,5 @@
// Extensionless relative path ES import in an ES module
import { foo } from "./foo"; // should error, suggest adding ".js"
~~~~~~~
!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean './foo.js'?
!!! error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './foo.js'?

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