typescript 5.7.0-dev.20240923 → 5.7.0-dev.20240925
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.es2015.core.d.ts +9 -9
- package/lib/lib.es2015.iterable.d.ts +90 -27
- package/lib/lib.es2015.symbol.wellknown.d.ts +10 -10
- package/lib/lib.es2016.array.include.d.ts +9 -9
- package/lib/lib.es2017.sharedmemory.d.ts +12 -12
- package/lib/lib.es2017.typedarrays.d.ts +9 -9
- package/lib/lib.es2020.bigint.d.ts +51 -49
- package/lib/lib.es2020.sharedmemory.d.ts +11 -11
- package/lib/lib.es2022.array.d.ts +11 -11
- package/lib/lib.es2023.array.d.ts +99 -99
- package/lib/lib.es5.d.ts +251 -251
- package/lib/tsc.js +191 -47
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +199 -52
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
|
@@ -2270,7 +2270,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2270
2270
|
|
|
2271
2271
|
// src/compiler/corePublic.ts
|
|
2272
2272
|
var versionMajorMinor = "5.7";
|
|
2273
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2273
|
+
var version = `${versionMajorMinor}.0-dev.20240925`;
|
|
2274
2274
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2275
2275
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2276
2276
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -9550,6 +9550,8 @@ var Diagnostics = {
|
|
|
9550
9550
|
),
|
|
9551
9551
|
Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute: diag(1541, 1 /* Error */, "Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribut_1541", "Type-only import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute."),
|
|
9552
9552
|
Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute: diag(1542, 1 /* Error */, "Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute_1542", "Type import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute."),
|
|
9553
|
+
Importing_a_JSON_file_into_an_ECMAScript_module_requires_a_type_Colon_json_import_attribute_when_module_is_set_to_0: diag(1543, 1 /* Error */, "Importing_a_JSON_file_into_an_ECMAScript_module_requires_a_type_Colon_json_import_attribute_when_mod_1543", `Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to '{0}'.`),
|
|
9554
|
+
Named_imports_from_a_JSON_file_into_an_ECMAScript_module_are_not_allowed_when_module_is_set_to_0: diag(1544, 1 /* Error */, "Named_imports_from_a_JSON_file_into_an_ECMAScript_module_are_not_allowed_when_module_is_set_to_0_1544", "Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to '{0}'."),
|
|
9553
9555
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
9554
9556
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
9555
9557
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -10121,6 +10123,8 @@ var Diagnostics = {
|
|
|
10121
10123
|
This_expression_is_always_nullish: diag(2871, 1 /* Error */, "This_expression_is_always_nullish_2871", "This expression is always nullish."),
|
|
10122
10124
|
This_kind_of_expression_is_always_truthy: diag(2872, 1 /* Error */, "This_kind_of_expression_is_always_truthy_2872", "This kind of expression is always truthy."),
|
|
10123
10125
|
This_kind_of_expression_is_always_falsy: diag(2873, 1 /* Error */, "This_kind_of_expression_is_always_falsy_2873", "This kind of expression is always falsy."),
|
|
10126
|
+
This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found: diag(2874, 1 /* Error */, "This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found_2874", "This JSX tag requires '{0}' to be in scope, but it could not be found."),
|
|
10127
|
+
This_JSX_tag_requires_the_module_path_0_to_exist_but_none_could_be_found_Make_sure_you_have_types_for_the_appropriate_package_installed: diag(2875, 1 /* Error */, "This_JSX_tag_requires_the_module_path_0_to_exist_but_none_could_be_found_Make_sure_you_have_types_fo_2875", "This JSX tag requires the module path '{0}' to exist, but none could be found. Make sure you have types for the appropriate package installed."),
|
|
10124
10128
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
10125
10129
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
10126
10130
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -39842,9 +39846,10 @@ function getDeclarationFileExtension(fileName) {
|
|
|
39842
39846
|
return standardExtension;
|
|
39843
39847
|
}
|
|
39844
39848
|
if (fileExtensionIs(fileName, ".ts" /* Ts */)) {
|
|
39845
|
-
const
|
|
39849
|
+
const baseName = getBaseFileName(fileName);
|
|
39850
|
+
const index = baseName.lastIndexOf(".d.");
|
|
39846
39851
|
if (index >= 0) {
|
|
39847
|
-
return
|
|
39852
|
+
return baseName.substring(index);
|
|
39848
39853
|
}
|
|
39849
39854
|
}
|
|
39850
39855
|
return void 0;
|
|
@@ -52416,10 +52421,19 @@ function createTypeChecker(host) {
|
|
|
52416
52421
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
52417
52422
|
return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
|
|
52418
52423
|
}
|
|
52419
|
-
function isOnlyImportableAsDefault(usage) {
|
|
52424
|
+
function isOnlyImportableAsDefault(usage, resolvedModule) {
|
|
52420
52425
|
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
52421
52426
|
const usageMode = getEmitSyntaxForModuleSpecifierExpression(usage);
|
|
52422
|
-
|
|
52427
|
+
if (usageMode === 99 /* ESNext */) {
|
|
52428
|
+
resolvedModule ?? (resolvedModule = resolveExternalModuleName(
|
|
52429
|
+
usage,
|
|
52430
|
+
usage,
|
|
52431
|
+
/*ignoreErrors*/
|
|
52432
|
+
true
|
|
52433
|
+
));
|
|
52434
|
+
const targetFile = resolvedModule && getSourceFileOfModule(resolvedModule);
|
|
52435
|
+
return targetFile && (isJsonSourceFile(targetFile) || getDeclarationFileExtension(targetFile.fileName) === ".d.json.ts");
|
|
52436
|
+
}
|
|
52423
52437
|
}
|
|
52424
52438
|
return false;
|
|
52425
52439
|
}
|
|
@@ -52490,7 +52504,7 @@ function createTypeChecker(host) {
|
|
|
52490
52504
|
if (!specifier) {
|
|
52491
52505
|
return exportDefaultSymbol;
|
|
52492
52506
|
}
|
|
52493
|
-
const hasDefaultOnly = isOnlyImportableAsDefault(specifier);
|
|
52507
|
+
const hasDefaultOnly = isOnlyImportableAsDefault(specifier, moduleSymbol);
|
|
52494
52508
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
52495
52509
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
52496
52510
|
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
|
|
@@ -52692,12 +52706,14 @@ function createTypeChecker(host) {
|
|
|
52692
52706
|
let symbolFromModule = getExportOfModule(targetSymbol, nameText, specifier, dontResolveAlias);
|
|
52693
52707
|
if (symbolFromModule === void 0 && nameText === "default" /* Default */) {
|
|
52694
52708
|
const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
52695
|
-
if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
52709
|
+
if (isOnlyImportableAsDefault(moduleSpecifier, moduleSymbol) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
52696
52710
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
52697
52711
|
}
|
|
52698
52712
|
}
|
|
52699
52713
|
const symbol = symbolFromModule && symbolFromVariable && symbolFromModule !== symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable;
|
|
52700
|
-
if (
|
|
52714
|
+
if (isImportOrExportSpecifier(specifier) && isOnlyImportableAsDefault(moduleSpecifier, moduleSymbol) && nameText !== "default" /* Default */) {
|
|
52715
|
+
error2(name, Diagnostics.Named_imports_from_a_JSON_file_into_an_ECMAScript_module_are_not_allowed_when_module_is_set_to_0, ModuleKind[moduleKind]);
|
|
52716
|
+
} else if (!symbol) {
|
|
52701
52717
|
errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name);
|
|
52702
52718
|
}
|
|
52703
52719
|
return symbol;
|
|
@@ -61008,11 +61024,20 @@ function createTypeChecker(host) {
|
|
|
61008
61024
|
return type;
|
|
61009
61025
|
}
|
|
61010
61026
|
function isLateBindableName(node) {
|
|
61027
|
+
return isLateBindableAST(node) && isTypeUsableAsPropertyName(isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached(node.argumentExpression));
|
|
61028
|
+
}
|
|
61029
|
+
function isLateBindableIndexSignature(node) {
|
|
61030
|
+
return isLateBindableAST(node) && isTypeUsableAsIndexSignature(isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached(node.argumentExpression));
|
|
61031
|
+
}
|
|
61032
|
+
function isLateBindableAST(node) {
|
|
61011
61033
|
if (!isComputedPropertyName(node) && !isElementAccessExpression(node)) {
|
|
61012
61034
|
return false;
|
|
61013
61035
|
}
|
|
61014
61036
|
const expr = isComputedPropertyName(node) ? node.expression : node.argumentExpression;
|
|
61015
|
-
return isEntityNameExpression(expr)
|
|
61037
|
+
return isEntityNameExpression(expr);
|
|
61038
|
+
}
|
|
61039
|
+
function isTypeUsableAsIndexSignature(type) {
|
|
61040
|
+
return isTypeAssignableTo(type, stringNumberSymbolType);
|
|
61016
61041
|
}
|
|
61017
61042
|
function isLateBoundName(name) {
|
|
61018
61043
|
return name.charCodeAt(0) === 95 /* _ */ && name.charCodeAt(1) === 95 /* _ */ && name.charCodeAt(2) === 64 /* at */;
|
|
@@ -61021,6 +61046,10 @@ function createTypeChecker(host) {
|
|
|
61021
61046
|
const name = getNameOfDeclaration(node);
|
|
61022
61047
|
return !!name && isLateBindableName(name);
|
|
61023
61048
|
}
|
|
61049
|
+
function hasLateBindableIndexSignature(node) {
|
|
61050
|
+
const name = getNameOfDeclaration(node);
|
|
61051
|
+
return !!name && isLateBindableIndexSignature(name);
|
|
61052
|
+
}
|
|
61024
61053
|
function hasBindableName(node) {
|
|
61025
61054
|
return !hasDynamicName(node) || hasLateBindableName(node);
|
|
61026
61055
|
}
|
|
@@ -61074,6 +61103,24 @@ function createTypeChecker(host) {
|
|
|
61074
61103
|
}
|
|
61075
61104
|
return links.resolvedSymbol;
|
|
61076
61105
|
}
|
|
61106
|
+
function lateBindIndexSignature(parent2, earlySymbols, lateSymbols, decl) {
|
|
61107
|
+
let indexSymbol = lateSymbols.get("__index" /* Index */);
|
|
61108
|
+
if (!indexSymbol) {
|
|
61109
|
+
const early = earlySymbols == null ? void 0 : earlySymbols.get("__index" /* Index */);
|
|
61110
|
+
if (!early) {
|
|
61111
|
+
indexSymbol = createSymbol(0 /* None */, "__index" /* Index */, 4096 /* Late */);
|
|
61112
|
+
} else {
|
|
61113
|
+
indexSymbol = cloneSymbol(early);
|
|
61114
|
+
indexSymbol.links.checkFlags |= 4096 /* Late */;
|
|
61115
|
+
}
|
|
61116
|
+
lateSymbols.set("__index" /* Index */, indexSymbol);
|
|
61117
|
+
}
|
|
61118
|
+
if (!indexSymbol.declarations) {
|
|
61119
|
+
indexSymbol.declarations = [decl];
|
|
61120
|
+
} else if (!decl.symbol.isReplaceableByMethod) {
|
|
61121
|
+
indexSymbol.declarations.push(decl);
|
|
61122
|
+
}
|
|
61123
|
+
}
|
|
61077
61124
|
function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
|
|
61078
61125
|
const links = getSymbolLinks(symbol);
|
|
61079
61126
|
if (!links[resolutionKind]) {
|
|
@@ -61088,6 +61135,8 @@ function createTypeChecker(host) {
|
|
|
61088
61135
|
if (isStatic2 === hasStaticModifier(member)) {
|
|
61089
61136
|
if (hasLateBindableName(member)) {
|
|
61090
61137
|
lateBindMember(symbol, earlySymbols, lateSymbols, member);
|
|
61138
|
+
} else if (hasLateBindableIndexSignature(member)) {
|
|
61139
|
+
lateBindIndexSignature(symbol, earlySymbols, lateSymbols, member);
|
|
61091
61140
|
}
|
|
61092
61141
|
}
|
|
61093
61142
|
}
|
|
@@ -61732,7 +61781,7 @@ function createTypeChecker(host) {
|
|
|
61732
61781
|
}
|
|
61733
61782
|
const indexSymbol = getIndexSymbolFromSymbolTable(members);
|
|
61734
61783
|
if (indexSymbol) {
|
|
61735
|
-
indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
|
|
61784
|
+
indexInfos = getIndexInfosOfIndexSymbol(indexSymbol, arrayFrom(members.values()));
|
|
61736
61785
|
} else {
|
|
61737
61786
|
if (baseConstructorIndexInfo) {
|
|
61738
61787
|
indexInfos = append(indexInfos, baseConstructorIndexInfo);
|
|
@@ -63351,7 +63400,7 @@ function createTypeChecker(host) {
|
|
|
63351
63400
|
return signature.isolatedSignatureType;
|
|
63352
63401
|
}
|
|
63353
63402
|
function getIndexSymbol(symbol) {
|
|
63354
|
-
return symbol.members ? getIndexSymbolFromSymbolTable(symbol
|
|
63403
|
+
return symbol.members ? getIndexSymbolFromSymbolTable(getMembersOfSymbol(symbol)) : void 0;
|
|
63355
63404
|
}
|
|
63356
63405
|
function getIndexSymbolFromSymbolTable(symbolTable) {
|
|
63357
63406
|
return symbolTable.get("__index" /* Index */);
|
|
@@ -63361,23 +63410,61 @@ function createTypeChecker(host) {
|
|
|
63361
63410
|
}
|
|
63362
63411
|
function getIndexInfosOfSymbol(symbol) {
|
|
63363
63412
|
const indexSymbol = getIndexSymbol(symbol);
|
|
63364
|
-
return indexSymbol ? getIndexInfosOfIndexSymbol(indexSymbol) : emptyArray;
|
|
63413
|
+
return indexSymbol ? getIndexInfosOfIndexSymbol(indexSymbol, arrayFrom(getMembersOfSymbol(symbol).values())) : emptyArray;
|
|
63365
63414
|
}
|
|
63366
|
-
function getIndexInfosOfIndexSymbol(indexSymbol) {
|
|
63415
|
+
function getIndexInfosOfIndexSymbol(indexSymbol, siblingSymbols = indexSymbol.parent ? arrayFrom(getMembersOfSymbol(indexSymbol.parent).values()) : void 0) {
|
|
63367
63416
|
if (indexSymbol.declarations) {
|
|
63368
63417
|
const indexInfos = [];
|
|
63418
|
+
let hasComputedNumberProperty = false;
|
|
63419
|
+
let readonlyComputedNumberProperty = true;
|
|
63420
|
+
let hasComputedSymbolProperty = false;
|
|
63421
|
+
let readonlyComputedSymbolProperty = true;
|
|
63422
|
+
let hasComputedStringProperty = false;
|
|
63423
|
+
let readonlyComputedStringProperty = true;
|
|
63424
|
+
const computedPropertySymbols = [];
|
|
63369
63425
|
for (const declaration of indexSymbol.declarations) {
|
|
63370
|
-
if (declaration
|
|
63371
|
-
|
|
63372
|
-
|
|
63373
|
-
|
|
63374
|
-
|
|
63375
|
-
|
|
63426
|
+
if (isIndexSignatureDeclaration(declaration)) {
|
|
63427
|
+
if (declaration.parameters.length === 1) {
|
|
63428
|
+
const parameter = declaration.parameters[0];
|
|
63429
|
+
if (parameter.type) {
|
|
63430
|
+
forEachType(getTypeFromTypeNode(parameter.type), (keyType) => {
|
|
63431
|
+
if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos, keyType)) {
|
|
63432
|
+
indexInfos.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, hasEffectiveModifier(declaration, 8 /* Readonly */), declaration));
|
|
63433
|
+
}
|
|
63434
|
+
});
|
|
63435
|
+
}
|
|
63436
|
+
}
|
|
63437
|
+
} else if (hasLateBindableIndexSignature(declaration)) {
|
|
63438
|
+
const declName = isBinaryExpression(declaration) ? declaration.left : declaration.name;
|
|
63439
|
+
const keyType = isElementAccessExpression(declName) ? checkExpressionCached(declName.argumentExpression) : checkComputedPropertyName(declName);
|
|
63440
|
+
if (findIndexInfo(indexInfos, keyType)) {
|
|
63441
|
+
continue;
|
|
63442
|
+
}
|
|
63443
|
+
if (isTypeAssignableTo(keyType, stringNumberSymbolType)) {
|
|
63444
|
+
if (isTypeAssignableTo(keyType, numberType)) {
|
|
63445
|
+
hasComputedNumberProperty = true;
|
|
63446
|
+
if (!hasEffectiveReadonlyModifier(declaration)) {
|
|
63447
|
+
readonlyComputedNumberProperty = false;
|
|
63376
63448
|
}
|
|
63377
|
-
})
|
|
63449
|
+
} else if (isTypeAssignableTo(keyType, esSymbolType)) {
|
|
63450
|
+
hasComputedSymbolProperty = true;
|
|
63451
|
+
if (!hasEffectiveReadonlyModifier(declaration)) {
|
|
63452
|
+
readonlyComputedSymbolProperty = false;
|
|
63453
|
+
}
|
|
63454
|
+
} else {
|
|
63455
|
+
hasComputedStringProperty = true;
|
|
63456
|
+
if (!hasEffectiveReadonlyModifier(declaration)) {
|
|
63457
|
+
readonlyComputedStringProperty = false;
|
|
63458
|
+
}
|
|
63459
|
+
}
|
|
63460
|
+
computedPropertySymbols.push(declaration.symbol);
|
|
63378
63461
|
}
|
|
63379
63462
|
}
|
|
63380
63463
|
}
|
|
63464
|
+
const allPropertySymbols = concatenate(computedPropertySymbols, filter(siblingSymbols, (s) => s !== indexSymbol));
|
|
63465
|
+
if (hasComputedStringProperty && !findIndexInfo(indexInfos, stringType)) indexInfos.push(getObjectLiteralIndexInfo(readonlyComputedStringProperty, 0, allPropertySymbols, stringType));
|
|
63466
|
+
if (hasComputedNumberProperty && !findIndexInfo(indexInfos, numberType)) indexInfos.push(getObjectLiteralIndexInfo(readonlyComputedNumberProperty, 0, allPropertySymbols, numberType));
|
|
63467
|
+
if (hasComputedSymbolProperty && !findIndexInfo(indexInfos, esSymbolType)) indexInfos.push(getObjectLiteralIndexInfo(readonlyComputedSymbolProperty, 0, allPropertySymbols, esSymbolType));
|
|
63381
63468
|
return indexInfos;
|
|
63382
63469
|
}
|
|
63383
63470
|
return emptyArray;
|
|
@@ -75007,7 +75094,7 @@ function createTypeChecker(host) {
|
|
|
75007
75094
|
}
|
|
75008
75095
|
function markJsxAliasReferenced(node) {
|
|
75009
75096
|
if (!getJsxNamespaceContainerForImplicitImport(node)) {
|
|
75010
|
-
const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? Diagnostics.
|
|
75097
|
+
const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? Diagnostics.This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found : void 0;
|
|
75011
75098
|
const jsxFactoryNamespace = getJsxNamespace(node);
|
|
75012
75099
|
const jsxFactoryLocation = isJsxOpeningLikeElement(node) ? node.tagName : node;
|
|
75013
75100
|
let jsxFactorySym;
|
|
@@ -77261,7 +77348,7 @@ function createTypeChecker(host) {
|
|
|
77261
77348
|
const firstDecl = (_a = symbol.declarations) == null ? void 0 : _a[0];
|
|
77262
77349
|
return isKnownSymbol(symbol) || firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 4096 /* ESSymbol */);
|
|
77263
77350
|
}
|
|
77264
|
-
function getObjectLiteralIndexInfo(
|
|
77351
|
+
function getObjectLiteralIndexInfo(isReadonly, offset, properties, keyType) {
|
|
77265
77352
|
const propTypes = [];
|
|
77266
77353
|
for (let i = offset; i < properties.length; i++) {
|
|
77267
77354
|
const prop = properties[i];
|
|
@@ -77270,7 +77357,7 @@ function createTypeChecker(host) {
|
|
|
77270
77357
|
}
|
|
77271
77358
|
}
|
|
77272
77359
|
const unionType = propTypes.length ? getUnionType(propTypes, 2 /* Subtype */) : undefinedType;
|
|
77273
|
-
return createIndexInfo(keyType, unionType,
|
|
77360
|
+
return createIndexInfo(keyType, unionType, isReadonly);
|
|
77274
77361
|
}
|
|
77275
77362
|
function getImmediateAliasedSymbol(symbol) {
|
|
77276
77363
|
Debug.assert((symbol.flags & 2097152 /* Alias */) !== 0, "Should only get Alias here.");
|
|
@@ -77433,9 +77520,10 @@ function createTypeChecker(host) {
|
|
|
77433
77520
|
return createObjectLiteralType();
|
|
77434
77521
|
function createObjectLiteralType() {
|
|
77435
77522
|
const indexInfos = [];
|
|
77436
|
-
|
|
77437
|
-
if (
|
|
77438
|
-
if (
|
|
77523
|
+
const isReadonly = isConstContext(node);
|
|
77524
|
+
if (hasComputedStringProperty) indexInfos.push(getObjectLiteralIndexInfo(isReadonly, offset, propertiesArray, stringType));
|
|
77525
|
+
if (hasComputedNumberProperty) indexInfos.push(getObjectLiteralIndexInfo(isReadonly, offset, propertiesArray, numberType));
|
|
77526
|
+
if (hasComputedSymbolProperty) indexInfos.push(getObjectLiteralIndexInfo(isReadonly, offset, propertiesArray, esSymbolType));
|
|
77439
77527
|
const result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, indexInfos);
|
|
77440
77528
|
result.objectFlags |= objectFlags | 128 /* ObjectLiteral */ | 131072 /* ContainsObjectOrArrayLiteral */;
|
|
77441
77529
|
if (isJSObjectLiteral) {
|
|
@@ -77716,7 +77804,7 @@ function createTypeChecker(host) {
|
|
|
77716
77804
|
return void 0;
|
|
77717
77805
|
}
|
|
77718
77806
|
const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */;
|
|
77719
|
-
const errorMessage = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.
|
|
77807
|
+
const errorMessage = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.This_JSX_tag_requires_the_module_path_0_to_exist_but_none_could_be_found_Make_sure_you_have_types_for_the_appropriate_package_installed;
|
|
77720
77808
|
const specifier = getJSXRuntimeImportSpecifier(file, runtimeImportSpecifier);
|
|
77721
77809
|
const mod = resolveExternalModule(specifier || location, runtimeImportSpecifier, errorMessage, location);
|
|
77722
77810
|
const result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : void 0;
|
|
@@ -81080,9 +81168,17 @@ function createTypeChecker(host) {
|
|
|
81080
81168
|
if (exprType === silentNeverType || isErrorType(exprType) || !some(typeArguments)) {
|
|
81081
81169
|
return exprType;
|
|
81082
81170
|
}
|
|
81171
|
+
const links = getNodeLinks(node);
|
|
81172
|
+
if (!links.instantiationExpressionTypes) {
|
|
81173
|
+
links.instantiationExpressionTypes = /* @__PURE__ */ new Map();
|
|
81174
|
+
}
|
|
81175
|
+
if (links.instantiationExpressionTypes.has(exprType.id)) {
|
|
81176
|
+
return links.instantiationExpressionTypes.get(exprType.id);
|
|
81177
|
+
}
|
|
81083
81178
|
let hasSomeApplicableSignature = false;
|
|
81084
81179
|
let nonApplicableType;
|
|
81085
81180
|
const result = getInstantiatedType(exprType);
|
|
81181
|
+
links.instantiationExpressionTypes.set(exprType.id, result);
|
|
81086
81182
|
const errorType2 = hasSomeApplicableSignature ? nonApplicableType : exprType;
|
|
81087
81183
|
if (errorType2) {
|
|
81088
81184
|
diagnostics.add(createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable, typeToString(errorType2)));
|
|
@@ -84551,15 +84647,17 @@ function createTypeChecker(host) {
|
|
|
84551
84647
|
if (indexSymbol == null ? void 0 : indexSymbol.declarations) {
|
|
84552
84648
|
const indexSignatureMap = /* @__PURE__ */ new Map();
|
|
84553
84649
|
for (const declaration of indexSymbol.declarations) {
|
|
84554
|
-
if (declaration
|
|
84555
|
-
|
|
84556
|
-
|
|
84557
|
-
|
|
84558
|
-
entry
|
|
84559
|
-
|
|
84560
|
-
|
|
84561
|
-
|
|
84562
|
-
|
|
84650
|
+
if (isIndexSignatureDeclaration(declaration)) {
|
|
84651
|
+
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
84652
|
+
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), (type) => {
|
|
84653
|
+
const entry = indexSignatureMap.get(getTypeId(type));
|
|
84654
|
+
if (entry) {
|
|
84655
|
+
entry.declarations.push(declaration);
|
|
84656
|
+
} else {
|
|
84657
|
+
indexSignatureMap.set(getTypeId(type), { type, declarations: [declaration] });
|
|
84658
|
+
}
|
|
84659
|
+
});
|
|
84660
|
+
}
|
|
84563
84661
|
}
|
|
84564
84662
|
}
|
|
84565
84663
|
indexSignatureMap.forEach((entry) => {
|
|
@@ -89133,6 +89231,7 @@ function createTypeChecker(host) {
|
|
|
89133
89231
|
grammarErrorOnFirstToken(node, Diagnostics.An_import_declaration_cannot_have_modifiers);
|
|
89134
89232
|
}
|
|
89135
89233
|
if (checkExternalImportOrExportDeclaration(node)) {
|
|
89234
|
+
let resolvedModule;
|
|
89136
89235
|
const importClause = node.importClause;
|
|
89137
89236
|
if (importClause && !checkGrammarImportClause(importClause)) {
|
|
89138
89237
|
if (importClause.name) {
|
|
@@ -89145,18 +89244,27 @@ function createTypeChecker(host) {
|
|
|
89145
89244
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
89146
89245
|
}
|
|
89147
89246
|
} else {
|
|
89148
|
-
|
|
89149
|
-
if (
|
|
89247
|
+
resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);
|
|
89248
|
+
if (resolvedModule) {
|
|
89150
89249
|
forEach(importClause.namedBindings.elements, checkImportBinding);
|
|
89151
89250
|
}
|
|
89152
89251
|
}
|
|
89153
89252
|
}
|
|
89253
|
+
if (isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) {
|
|
89254
|
+
error2(node.moduleSpecifier, Diagnostics.Importing_a_JSON_file_into_an_ECMAScript_module_requires_a_type_Colon_json_import_attribute_when_module_is_set_to_0, ModuleKind[moduleKind]);
|
|
89255
|
+
}
|
|
89154
89256
|
} else if (noUncheckedSideEffectImports && !importClause) {
|
|
89155
89257
|
void resolveExternalModuleName(node, node.moduleSpecifier);
|
|
89156
89258
|
}
|
|
89157
89259
|
}
|
|
89158
89260
|
checkImportAttributes(node);
|
|
89159
89261
|
}
|
|
89262
|
+
function hasTypeJsonImportAttribute(node) {
|
|
89263
|
+
return !!node.attributes && node.attributes.elements.some((attr) => {
|
|
89264
|
+
var _a;
|
|
89265
|
+
return getTextOfIdentifierOrLiteral(attr.name) === "type" && ((_a = tryCast(attr.value, isStringLiteralLike)) == null ? void 0 : _a.text) === "json";
|
|
89266
|
+
});
|
|
89267
|
+
}
|
|
89160
89268
|
function checkImportEqualsDeclaration(node) {
|
|
89161
89269
|
if (checkGrammarModuleElementContext(node, isInJSFile(node) ? Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module : Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
|
|
89162
89270
|
return;
|
|
@@ -90273,7 +90381,7 @@ function createTypeChecker(host) {
|
|
|
90273
90381
|
} else if (isJSDocMemberName(name)) {
|
|
90274
90382
|
return resolveJSDocMemberName(name);
|
|
90275
90383
|
}
|
|
90276
|
-
} else if (isTypeReferenceIdentifier(name)) {
|
|
90384
|
+
} else if (isEntityName(name) && isTypeReferenceIdentifier(name)) {
|
|
90277
90385
|
const meaning = name.parent.kind === 183 /* TypeReference */ ? 788968 /* Type */ : 1920 /* Namespace */;
|
|
90278
90386
|
const symbol = resolveEntityName(
|
|
90279
90387
|
name,
|
|
@@ -91467,7 +91575,29 @@ function createTypeChecker(host) {
|
|
|
91467
91575
|
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, internalFlags, tracker);
|
|
91468
91576
|
},
|
|
91469
91577
|
isImportRequiredByAugmentation,
|
|
91470
|
-
isDefinitelyReferenceToGlobalSymbolObject
|
|
91578
|
+
isDefinitelyReferenceToGlobalSymbolObject,
|
|
91579
|
+
createLateBoundIndexSignatures: (cls, enclosing, flags, internalFlags, tracker) => {
|
|
91580
|
+
const sym = cls.symbol;
|
|
91581
|
+
const staticInfos = getIndexInfosOfType(getTypeOfSymbol(sym));
|
|
91582
|
+
const instanceIndexSymbol = getIndexSymbol(sym);
|
|
91583
|
+
const instanceInfos = instanceIndexSymbol && getIndexInfosOfIndexSymbol(instanceIndexSymbol, arrayFrom(getMembersOfSymbol(sym).values()));
|
|
91584
|
+
let result;
|
|
91585
|
+
for (const infoList of [staticInfos, instanceInfos]) {
|
|
91586
|
+
if (!length(infoList)) continue;
|
|
91587
|
+
result || (result = []);
|
|
91588
|
+
for (const info of infoList) {
|
|
91589
|
+
if (info.declaration) continue;
|
|
91590
|
+
const node = nodeBuilder.indexInfoToIndexSignatureDeclaration(info, enclosing, flags, internalFlags, tracker);
|
|
91591
|
+
if (node && infoList === staticInfos) {
|
|
91592
|
+
(node.modifiers || (node.modifiers = factory.createNodeArray())).unshift(factory.createModifier(126 /* StaticKeyword */));
|
|
91593
|
+
}
|
|
91594
|
+
if (node) {
|
|
91595
|
+
result.push(node);
|
|
91596
|
+
}
|
|
91597
|
+
}
|
|
91598
|
+
}
|
|
91599
|
+
return result;
|
|
91600
|
+
}
|
|
91471
91601
|
};
|
|
91472
91602
|
function isImportRequiredByAugmentation(node) {
|
|
91473
91603
|
const file = getSourceFileOfNode(node);
|
|
@@ -118134,7 +118264,8 @@ function transformDeclarations(context) {
|
|
|
118134
118264
|
void 0
|
|
118135
118265
|
)
|
|
118136
118266
|
] : void 0;
|
|
118137
|
-
const
|
|
118267
|
+
const lateIndexes = resolver.createLateBoundIndexSignatures(input, enclosingDeclaration, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
|
|
118268
|
+
const memberNodes = concatenate(concatenate(concatenate(privateIdentifier, lateIndexes), parameterProperties), visitNodes2(input.members, visitDeclarationSubtree, isClassElement));
|
|
118138
118269
|
const members = factory2.createNodeArray(memberNodes);
|
|
118139
118270
|
const extendsClause = getEffectiveBaseTypeNode(input);
|
|
118140
118271
|
if (extendsClause && !isEntityNameExpression(extendsClause.expression) && extendsClause.expression.kind !== 106 /* NullKeyword */) {
|
|
@@ -119450,7 +119581,8 @@ var notImplementedResolver = {
|
|
|
119450
119581
|
isBindingCapturedByNode: notImplemented,
|
|
119451
119582
|
getDeclarationStatementsForSourceFile: notImplemented,
|
|
119452
119583
|
isImportRequiredByAugmentation: notImplemented,
|
|
119453
|
-
isDefinitelyReferenceToGlobalSymbolObject: notImplemented
|
|
119584
|
+
isDefinitelyReferenceToGlobalSymbolObject: notImplemented,
|
|
119585
|
+
createLateBoundIndexSignatures: notImplemented
|
|
119454
119586
|
};
|
|
119455
119587
|
var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
|
|
119456
119588
|
var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
|
|
@@ -125650,7 +125782,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125650
125782
|
return (_a2 = resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.get(file.path)) == null ? void 0 : _a2.get(typeDirectiveName, mode);
|
|
125651
125783
|
}
|
|
125652
125784
|
function getResolvedTypeReferenceDirectiveFromTypeReferenceDirective(typeRef, sourceFile) {
|
|
125653
|
-
return getResolvedTypeReferenceDirective(
|
|
125785
|
+
return getResolvedTypeReferenceDirective(
|
|
125786
|
+
sourceFile,
|
|
125787
|
+
typeRef.fileName,
|
|
125788
|
+
getModeForTypeReferenceDirectiveInFile(typeRef, sourceFile)
|
|
125789
|
+
);
|
|
125654
125790
|
}
|
|
125655
125791
|
function forEachResolvedModule(callback, file) {
|
|
125656
125792
|
forEachResolution(resolvedModules, callback, file);
|
|
@@ -126037,10 +126173,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126037
126173
|
const moduleNames = getModuleNames(newSourceFile);
|
|
126038
126174
|
const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
126039
126175
|
(resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
|
|
126176
|
+
const optionsForFile = getCompilerOptionsForFile(newSourceFile);
|
|
126040
126177
|
const resolutionsChanged = hasChangesInResolutions(
|
|
126041
126178
|
moduleNames,
|
|
126042
126179
|
resolutions,
|
|
126043
|
-
(name) => oldProgram.getResolvedModule(newSourceFile, name.text,
|
|
126180
|
+
(name) => oldProgram.getResolvedModule(newSourceFile, name.text, getModeForUsageLocationWorker(newSourceFile, name, optionsForFile)),
|
|
126044
126181
|
moduleResolutionIsEqualTo
|
|
126045
126182
|
);
|
|
126046
126183
|
if (resolutionsChanged) structureIsReused = 1 /* SafeModules */;
|
|
@@ -126050,7 +126187,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126050
126187
|
const typeReferenceResolutionsChanged = hasChangesInResolutions(
|
|
126051
126188
|
typesReferenceDirectives,
|
|
126052
126189
|
typeReferenceResolutions,
|
|
126053
|
-
(name) => oldProgram.getResolvedTypeReferenceDirective(
|
|
126190
|
+
(name) => oldProgram.getResolvedTypeReferenceDirective(
|
|
126191
|
+
newSourceFile,
|
|
126192
|
+
getTypeReferenceResolutionName(name),
|
|
126193
|
+
getModeForTypeReferenceDirectiveInFile(name, newSourceFile)
|
|
126194
|
+
),
|
|
126054
126195
|
typeDirectiveIsEqualTo
|
|
126055
126196
|
);
|
|
126056
126197
|
if (typeReferenceResolutionsChanged) structureIsReused = 1 /* SafeModules */;
|
|
@@ -127211,8 +127352,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
127211
127352
|
const ref = file.typeReferenceDirectives[index];
|
|
127212
127353
|
const resolvedTypeReferenceDirective = resolutions[index];
|
|
127213
127354
|
const fileName = ref.fileName;
|
|
127214
|
-
|
|
127215
|
-
|
|
127355
|
+
const mode = getModeForTypeReferenceDirectiveInFile(ref, file);
|
|
127356
|
+
resolutionsInFile.set(fileName, mode, resolvedTypeReferenceDirective);
|
|
127216
127357
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
127217
127358
|
}
|
|
127218
127359
|
}
|
|
@@ -128256,6 +128397,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
128256
128397
|
function shouldTransformImportCall(sourceFile) {
|
|
128257
128398
|
return shouldTransformImportCallWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
128258
128399
|
}
|
|
128400
|
+
function getModeForTypeReferenceDirectiveInFile(ref, sourceFile) {
|
|
128401
|
+
return ref.resolutionMode || getDefaultResolutionModeForFile2(sourceFile);
|
|
128402
|
+
}
|
|
128259
128403
|
}
|
|
128260
128404
|
function shouldTransformImportCallWorker(sourceFile, options) {
|
|
128261
128405
|
const moduleKind = getEmitModuleKind(options);
|
|
@@ -155767,7 +155911,8 @@ var errorCodes19 = [
|
|
|
155767
155911
|
Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha.code,
|
|
155768
155912
|
Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode.code,
|
|
155769
155913
|
Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig.code,
|
|
155770
|
-
Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code
|
|
155914
|
+
Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code,
|
|
155915
|
+
Diagnostics.This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found.code
|
|
155771
155916
|
];
|
|
155772
155917
|
registerCodeFix({
|
|
155773
155918
|
errorCodes: errorCodes19,
|
|
@@ -159089,17 +159234,19 @@ function getParameterType(importAdder, typeNode, scriptTarget) {
|
|
|
159089
159234
|
var fixName2 = "fixCannotFindModule";
|
|
159090
159235
|
var fixIdInstallTypesPackage = "installTypesPackage";
|
|
159091
159236
|
var errorCodeCannotFindModule = Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations.code;
|
|
159237
|
+
var errorCannotFindImplicitJsxImport = Diagnostics.This_JSX_tag_requires_the_module_path_0_to_exist_but_none_could_be_found_Make_sure_you_have_types_for_the_appropriate_package_installed.code;
|
|
159092
159238
|
var errorCodes31 = [
|
|
159093
159239
|
errorCodeCannotFindModule,
|
|
159094
|
-
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code
|
|
159240
|
+
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code,
|
|
159241
|
+
errorCannotFindImplicitJsxImport
|
|
159095
159242
|
];
|
|
159096
159243
|
registerCodeFix({
|
|
159097
159244
|
errorCodes: errorCodes31,
|
|
159098
159245
|
getCodeActions: function getCodeActionsToFixNotFoundModule(context) {
|
|
159099
|
-
const { host, sourceFile, span: { start } } = context;
|
|
159100
|
-
const packageName = tryGetImportedPackageName(sourceFile, start);
|
|
159246
|
+
const { host, sourceFile, span: { start }, errorCode } = context;
|
|
159247
|
+
const packageName = errorCode === errorCannotFindImplicitJsxImport ? getJSXImplicitImportBase(context.program.getCompilerOptions(), sourceFile) : tryGetImportedPackageName(sourceFile, start);
|
|
159101
159248
|
if (packageName === void 0) return void 0;
|
|
159102
|
-
const typesPackageName = getTypesPackageNameToInstall(packageName, host,
|
|
159249
|
+
const typesPackageName = getTypesPackageNameToInstall(packageName, host, errorCode);
|
|
159103
159250
|
return typesPackageName === void 0 ? [] : [createCodeFixAction(
|
|
159104
159251
|
fixName2,
|
|
159105
159252
|
/*changes*/
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.7.0-dev.
|
|
5
|
+
"version": "5.7.0-dev.20240925",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"node": "20.1.0",
|
|
117
117
|
"npm": "8.19.4"
|
|
118
118
|
},
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "e962037df334de071b8d3a9c70b13e3a600d1bc9"
|
|
120
120
|
}
|