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/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.7";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240925`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -6182,6 +6182,8 @@ var Diagnostics = {
|
|
|
6182
6182
|
),
|
|
6183
6183
|
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."),
|
|
6184
6184
|
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."),
|
|
6185
|
+
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}'.`),
|
|
6186
|
+
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}'."),
|
|
6185
6187
|
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."),
|
|
6186
6188
|
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."),
|
|
6187
6189
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -6753,6 +6755,8 @@ var Diagnostics = {
|
|
|
6753
6755
|
This_expression_is_always_nullish: diag(2871, 1 /* Error */, "This_expression_is_always_nullish_2871", "This expression is always nullish."),
|
|
6754
6756
|
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."),
|
|
6755
6757
|
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."),
|
|
6758
|
+
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."),
|
|
6759
|
+
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."),
|
|
6756
6760
|
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}'."),
|
|
6757
6761
|
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}'."),
|
|
6758
6762
|
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}'."),
|
|
@@ -35596,9 +35600,10 @@ function getDeclarationFileExtension(fileName) {
|
|
|
35596
35600
|
return standardExtension;
|
|
35597
35601
|
}
|
|
35598
35602
|
if (fileExtensionIs(fileName, ".ts" /* Ts */)) {
|
|
35599
|
-
const
|
|
35603
|
+
const baseName = getBaseFileName(fileName);
|
|
35604
|
+
const index = baseName.lastIndexOf(".d.");
|
|
35600
35605
|
if (index >= 0) {
|
|
35601
|
-
return
|
|
35606
|
+
return baseName.substring(index);
|
|
35602
35607
|
}
|
|
35603
35608
|
}
|
|
35604
35609
|
return void 0;
|
|
@@ -47820,10 +47825,19 @@ function createTypeChecker(host) {
|
|
|
47820
47825
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
47821
47826
|
return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
|
|
47822
47827
|
}
|
|
47823
|
-
function isOnlyImportableAsDefault(usage) {
|
|
47828
|
+
function isOnlyImportableAsDefault(usage, resolvedModule) {
|
|
47824
47829
|
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
47825
47830
|
const usageMode = getEmitSyntaxForModuleSpecifierExpression(usage);
|
|
47826
|
-
|
|
47831
|
+
if (usageMode === 99 /* ESNext */) {
|
|
47832
|
+
resolvedModule ?? (resolvedModule = resolveExternalModuleName(
|
|
47833
|
+
usage,
|
|
47834
|
+
usage,
|
|
47835
|
+
/*ignoreErrors*/
|
|
47836
|
+
true
|
|
47837
|
+
));
|
|
47838
|
+
const targetFile = resolvedModule && getSourceFileOfModule(resolvedModule);
|
|
47839
|
+
return targetFile && (isJsonSourceFile(targetFile) || getDeclarationFileExtension(targetFile.fileName) === ".d.json.ts");
|
|
47840
|
+
}
|
|
47827
47841
|
}
|
|
47828
47842
|
return false;
|
|
47829
47843
|
}
|
|
@@ -47894,7 +47908,7 @@ function createTypeChecker(host) {
|
|
|
47894
47908
|
if (!specifier) {
|
|
47895
47909
|
return exportDefaultSymbol;
|
|
47896
47910
|
}
|
|
47897
|
-
const hasDefaultOnly = isOnlyImportableAsDefault(specifier);
|
|
47911
|
+
const hasDefaultOnly = isOnlyImportableAsDefault(specifier, moduleSymbol);
|
|
47898
47912
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
47899
47913
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
47900
47914
|
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
|
|
@@ -48096,12 +48110,14 @@ function createTypeChecker(host) {
|
|
|
48096
48110
|
let symbolFromModule = getExportOfModule(targetSymbol, nameText, specifier, dontResolveAlias);
|
|
48097
48111
|
if (symbolFromModule === void 0 && nameText === "default" /* Default */) {
|
|
48098
48112
|
const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
48099
|
-
if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
48113
|
+
if (isOnlyImportableAsDefault(moduleSpecifier, moduleSymbol) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
48100
48114
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
48101
48115
|
}
|
|
48102
48116
|
}
|
|
48103
48117
|
const symbol = symbolFromModule && symbolFromVariable && symbolFromModule !== symbolFromVariable ? combineValueAndTypeSymbols(symbolFromVariable, symbolFromModule) : symbolFromModule || symbolFromVariable;
|
|
48104
|
-
if (
|
|
48118
|
+
if (isImportOrExportSpecifier(specifier) && isOnlyImportableAsDefault(moduleSpecifier, moduleSymbol) && nameText !== "default" /* Default */) {
|
|
48119
|
+
error(name, Diagnostics.Named_imports_from_a_JSON_file_into_an_ECMAScript_module_are_not_allowed_when_module_is_set_to_0, ModuleKind[moduleKind]);
|
|
48120
|
+
} else if (!symbol) {
|
|
48105
48121
|
errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name);
|
|
48106
48122
|
}
|
|
48107
48123
|
return symbol;
|
|
@@ -56412,11 +56428,20 @@ function createTypeChecker(host) {
|
|
|
56412
56428
|
return type;
|
|
56413
56429
|
}
|
|
56414
56430
|
function isLateBindableName(node) {
|
|
56431
|
+
return isLateBindableAST(node) && isTypeUsableAsPropertyName(isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached(node.argumentExpression));
|
|
56432
|
+
}
|
|
56433
|
+
function isLateBindableIndexSignature(node) {
|
|
56434
|
+
return isLateBindableAST(node) && isTypeUsableAsIndexSignature(isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached(node.argumentExpression));
|
|
56435
|
+
}
|
|
56436
|
+
function isLateBindableAST(node) {
|
|
56415
56437
|
if (!isComputedPropertyName(node) && !isElementAccessExpression(node)) {
|
|
56416
56438
|
return false;
|
|
56417
56439
|
}
|
|
56418
56440
|
const expr = isComputedPropertyName(node) ? node.expression : node.argumentExpression;
|
|
56419
|
-
return isEntityNameExpression(expr)
|
|
56441
|
+
return isEntityNameExpression(expr);
|
|
56442
|
+
}
|
|
56443
|
+
function isTypeUsableAsIndexSignature(type) {
|
|
56444
|
+
return isTypeAssignableTo(type, stringNumberSymbolType);
|
|
56420
56445
|
}
|
|
56421
56446
|
function isLateBoundName(name) {
|
|
56422
56447
|
return name.charCodeAt(0) === 95 /* _ */ && name.charCodeAt(1) === 95 /* _ */ && name.charCodeAt(2) === 64 /* at */;
|
|
@@ -56425,6 +56450,10 @@ function createTypeChecker(host) {
|
|
|
56425
56450
|
const name = getNameOfDeclaration(node);
|
|
56426
56451
|
return !!name && isLateBindableName(name);
|
|
56427
56452
|
}
|
|
56453
|
+
function hasLateBindableIndexSignature(node) {
|
|
56454
|
+
const name = getNameOfDeclaration(node);
|
|
56455
|
+
return !!name && isLateBindableIndexSignature(name);
|
|
56456
|
+
}
|
|
56428
56457
|
function hasBindableName(node) {
|
|
56429
56458
|
return !hasDynamicName(node) || hasLateBindableName(node);
|
|
56430
56459
|
}
|
|
@@ -56478,6 +56507,24 @@ function createTypeChecker(host) {
|
|
|
56478
56507
|
}
|
|
56479
56508
|
return links.resolvedSymbol;
|
|
56480
56509
|
}
|
|
56510
|
+
function lateBindIndexSignature(parent, earlySymbols, lateSymbols, decl) {
|
|
56511
|
+
let indexSymbol = lateSymbols.get("__index" /* Index */);
|
|
56512
|
+
if (!indexSymbol) {
|
|
56513
|
+
const early = earlySymbols == null ? void 0 : earlySymbols.get("__index" /* Index */);
|
|
56514
|
+
if (!early) {
|
|
56515
|
+
indexSymbol = createSymbol(0 /* None */, "__index" /* Index */, 4096 /* Late */);
|
|
56516
|
+
} else {
|
|
56517
|
+
indexSymbol = cloneSymbol(early);
|
|
56518
|
+
indexSymbol.links.checkFlags |= 4096 /* Late */;
|
|
56519
|
+
}
|
|
56520
|
+
lateSymbols.set("__index" /* Index */, indexSymbol);
|
|
56521
|
+
}
|
|
56522
|
+
if (!indexSymbol.declarations) {
|
|
56523
|
+
indexSymbol.declarations = [decl];
|
|
56524
|
+
} else if (!decl.symbol.isReplaceableByMethod) {
|
|
56525
|
+
indexSymbol.declarations.push(decl);
|
|
56526
|
+
}
|
|
56527
|
+
}
|
|
56481
56528
|
function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
|
|
56482
56529
|
const links = getSymbolLinks(symbol);
|
|
56483
56530
|
if (!links[resolutionKind]) {
|
|
@@ -56492,6 +56539,8 @@ function createTypeChecker(host) {
|
|
|
56492
56539
|
if (isStatic2 === hasStaticModifier(member)) {
|
|
56493
56540
|
if (hasLateBindableName(member)) {
|
|
56494
56541
|
lateBindMember(symbol, earlySymbols, lateSymbols, member);
|
|
56542
|
+
} else if (hasLateBindableIndexSignature(member)) {
|
|
56543
|
+
lateBindIndexSignature(symbol, earlySymbols, lateSymbols, member);
|
|
56495
56544
|
}
|
|
56496
56545
|
}
|
|
56497
56546
|
}
|
|
@@ -57136,7 +57185,7 @@ function createTypeChecker(host) {
|
|
|
57136
57185
|
}
|
|
57137
57186
|
const indexSymbol = getIndexSymbolFromSymbolTable(members);
|
|
57138
57187
|
if (indexSymbol) {
|
|
57139
|
-
indexInfos = getIndexInfosOfIndexSymbol(indexSymbol);
|
|
57188
|
+
indexInfos = getIndexInfosOfIndexSymbol(indexSymbol, arrayFrom(members.values()));
|
|
57140
57189
|
} else {
|
|
57141
57190
|
if (baseConstructorIndexInfo) {
|
|
57142
57191
|
indexInfos = append(indexInfos, baseConstructorIndexInfo);
|
|
@@ -58755,7 +58804,7 @@ function createTypeChecker(host) {
|
|
|
58755
58804
|
return signature.isolatedSignatureType;
|
|
58756
58805
|
}
|
|
58757
58806
|
function getIndexSymbol(symbol) {
|
|
58758
|
-
return symbol.members ? getIndexSymbolFromSymbolTable(symbol
|
|
58807
|
+
return symbol.members ? getIndexSymbolFromSymbolTable(getMembersOfSymbol(symbol)) : void 0;
|
|
58759
58808
|
}
|
|
58760
58809
|
function getIndexSymbolFromSymbolTable(symbolTable) {
|
|
58761
58810
|
return symbolTable.get("__index" /* Index */);
|
|
@@ -58765,23 +58814,61 @@ function createTypeChecker(host) {
|
|
|
58765
58814
|
}
|
|
58766
58815
|
function getIndexInfosOfSymbol(symbol) {
|
|
58767
58816
|
const indexSymbol = getIndexSymbol(symbol);
|
|
58768
|
-
return indexSymbol ? getIndexInfosOfIndexSymbol(indexSymbol) : emptyArray;
|
|
58817
|
+
return indexSymbol ? getIndexInfosOfIndexSymbol(indexSymbol, arrayFrom(getMembersOfSymbol(symbol).values())) : emptyArray;
|
|
58769
58818
|
}
|
|
58770
|
-
function getIndexInfosOfIndexSymbol(indexSymbol) {
|
|
58819
|
+
function getIndexInfosOfIndexSymbol(indexSymbol, siblingSymbols = indexSymbol.parent ? arrayFrom(getMembersOfSymbol(indexSymbol.parent).values()) : void 0) {
|
|
58771
58820
|
if (indexSymbol.declarations) {
|
|
58772
58821
|
const indexInfos = [];
|
|
58822
|
+
let hasComputedNumberProperty = false;
|
|
58823
|
+
let readonlyComputedNumberProperty = true;
|
|
58824
|
+
let hasComputedSymbolProperty = false;
|
|
58825
|
+
let readonlyComputedSymbolProperty = true;
|
|
58826
|
+
let hasComputedStringProperty = false;
|
|
58827
|
+
let readonlyComputedStringProperty = true;
|
|
58828
|
+
const computedPropertySymbols = [];
|
|
58773
58829
|
for (const declaration of indexSymbol.declarations) {
|
|
58774
|
-
if (declaration
|
|
58775
|
-
|
|
58776
|
-
|
|
58777
|
-
|
|
58778
|
-
|
|
58779
|
-
|
|
58830
|
+
if (isIndexSignatureDeclaration(declaration)) {
|
|
58831
|
+
if (declaration.parameters.length === 1) {
|
|
58832
|
+
const parameter = declaration.parameters[0];
|
|
58833
|
+
if (parameter.type) {
|
|
58834
|
+
forEachType(getTypeFromTypeNode(parameter.type), (keyType) => {
|
|
58835
|
+
if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos, keyType)) {
|
|
58836
|
+
indexInfos.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, hasEffectiveModifier(declaration, 8 /* Readonly */), declaration));
|
|
58837
|
+
}
|
|
58838
|
+
});
|
|
58839
|
+
}
|
|
58840
|
+
}
|
|
58841
|
+
} else if (hasLateBindableIndexSignature(declaration)) {
|
|
58842
|
+
const declName = isBinaryExpression(declaration) ? declaration.left : declaration.name;
|
|
58843
|
+
const keyType = isElementAccessExpression(declName) ? checkExpressionCached(declName.argumentExpression) : checkComputedPropertyName(declName);
|
|
58844
|
+
if (findIndexInfo(indexInfos, keyType)) {
|
|
58845
|
+
continue;
|
|
58846
|
+
}
|
|
58847
|
+
if (isTypeAssignableTo(keyType, stringNumberSymbolType)) {
|
|
58848
|
+
if (isTypeAssignableTo(keyType, numberType)) {
|
|
58849
|
+
hasComputedNumberProperty = true;
|
|
58850
|
+
if (!hasEffectiveReadonlyModifier(declaration)) {
|
|
58851
|
+
readonlyComputedNumberProperty = false;
|
|
58780
58852
|
}
|
|
58781
|
-
})
|
|
58853
|
+
} else if (isTypeAssignableTo(keyType, esSymbolType)) {
|
|
58854
|
+
hasComputedSymbolProperty = true;
|
|
58855
|
+
if (!hasEffectiveReadonlyModifier(declaration)) {
|
|
58856
|
+
readonlyComputedSymbolProperty = false;
|
|
58857
|
+
}
|
|
58858
|
+
} else {
|
|
58859
|
+
hasComputedStringProperty = true;
|
|
58860
|
+
if (!hasEffectiveReadonlyModifier(declaration)) {
|
|
58861
|
+
readonlyComputedStringProperty = false;
|
|
58862
|
+
}
|
|
58863
|
+
}
|
|
58864
|
+
computedPropertySymbols.push(declaration.symbol);
|
|
58782
58865
|
}
|
|
58783
58866
|
}
|
|
58784
58867
|
}
|
|
58868
|
+
const allPropertySymbols = concatenate(computedPropertySymbols, filter(siblingSymbols, (s) => s !== indexSymbol));
|
|
58869
|
+
if (hasComputedStringProperty && !findIndexInfo(indexInfos, stringType)) indexInfos.push(getObjectLiteralIndexInfo(readonlyComputedStringProperty, 0, allPropertySymbols, stringType));
|
|
58870
|
+
if (hasComputedNumberProperty && !findIndexInfo(indexInfos, numberType)) indexInfos.push(getObjectLiteralIndexInfo(readonlyComputedNumberProperty, 0, allPropertySymbols, numberType));
|
|
58871
|
+
if (hasComputedSymbolProperty && !findIndexInfo(indexInfos, esSymbolType)) indexInfos.push(getObjectLiteralIndexInfo(readonlyComputedSymbolProperty, 0, allPropertySymbols, esSymbolType));
|
|
58785
58872
|
return indexInfos;
|
|
58786
58873
|
}
|
|
58787
58874
|
return emptyArray;
|
|
@@ -70411,7 +70498,7 @@ function createTypeChecker(host) {
|
|
|
70411
70498
|
}
|
|
70412
70499
|
function markJsxAliasReferenced(node) {
|
|
70413
70500
|
if (!getJsxNamespaceContainerForImplicitImport(node)) {
|
|
70414
|
-
const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? Diagnostics.
|
|
70501
|
+
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;
|
|
70415
70502
|
const jsxFactoryNamespace = getJsxNamespace(node);
|
|
70416
70503
|
const jsxFactoryLocation = isJsxOpeningLikeElement(node) ? node.tagName : node;
|
|
70417
70504
|
let jsxFactorySym;
|
|
@@ -72665,7 +72752,7 @@ function createTypeChecker(host) {
|
|
|
72665
72752
|
const firstDecl = (_a = symbol.declarations) == null ? void 0 : _a[0];
|
|
72666
72753
|
return isKnownSymbol(symbol) || firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 4096 /* ESSymbol */);
|
|
72667
72754
|
}
|
|
72668
|
-
function getObjectLiteralIndexInfo(
|
|
72755
|
+
function getObjectLiteralIndexInfo(isReadonly, offset, properties, keyType) {
|
|
72669
72756
|
const propTypes = [];
|
|
72670
72757
|
for (let i = offset; i < properties.length; i++) {
|
|
72671
72758
|
const prop = properties[i];
|
|
@@ -72674,7 +72761,7 @@ function createTypeChecker(host) {
|
|
|
72674
72761
|
}
|
|
72675
72762
|
}
|
|
72676
72763
|
const unionType = propTypes.length ? getUnionType(propTypes, 2 /* Subtype */) : undefinedType;
|
|
72677
|
-
return createIndexInfo(keyType, unionType,
|
|
72764
|
+
return createIndexInfo(keyType, unionType, isReadonly);
|
|
72678
72765
|
}
|
|
72679
72766
|
function getImmediateAliasedSymbol(symbol) {
|
|
72680
72767
|
Debug.assert((symbol.flags & 2097152 /* Alias */) !== 0, "Should only get Alias here.");
|
|
@@ -72837,9 +72924,10 @@ function createTypeChecker(host) {
|
|
|
72837
72924
|
return createObjectLiteralType();
|
|
72838
72925
|
function createObjectLiteralType() {
|
|
72839
72926
|
const indexInfos = [];
|
|
72840
|
-
|
|
72841
|
-
if (
|
|
72842
|
-
if (
|
|
72927
|
+
const isReadonly = isConstContext(node);
|
|
72928
|
+
if (hasComputedStringProperty) indexInfos.push(getObjectLiteralIndexInfo(isReadonly, offset, propertiesArray, stringType));
|
|
72929
|
+
if (hasComputedNumberProperty) indexInfos.push(getObjectLiteralIndexInfo(isReadonly, offset, propertiesArray, numberType));
|
|
72930
|
+
if (hasComputedSymbolProperty) indexInfos.push(getObjectLiteralIndexInfo(isReadonly, offset, propertiesArray, esSymbolType));
|
|
72843
72931
|
const result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, indexInfos);
|
|
72844
72932
|
result.objectFlags |= objectFlags | 128 /* ObjectLiteral */ | 131072 /* ContainsObjectOrArrayLiteral */;
|
|
72845
72933
|
if (isJSObjectLiteral) {
|
|
@@ -73120,7 +73208,7 @@ function createTypeChecker(host) {
|
|
|
73120
73208
|
return void 0;
|
|
73121
73209
|
}
|
|
73122
73210
|
const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */;
|
|
73123
|
-
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.
|
|
73211
|
+
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;
|
|
73124
73212
|
const specifier = getJSXRuntimeImportSpecifier(file, runtimeImportSpecifier);
|
|
73125
73213
|
const mod = resolveExternalModule(specifier || location, runtimeImportSpecifier, errorMessage, location);
|
|
73126
73214
|
const result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : void 0;
|
|
@@ -76484,9 +76572,17 @@ function createTypeChecker(host) {
|
|
|
76484
76572
|
if (exprType === silentNeverType || isErrorType(exprType) || !some(typeArguments)) {
|
|
76485
76573
|
return exprType;
|
|
76486
76574
|
}
|
|
76575
|
+
const links = getNodeLinks(node);
|
|
76576
|
+
if (!links.instantiationExpressionTypes) {
|
|
76577
|
+
links.instantiationExpressionTypes = /* @__PURE__ */ new Map();
|
|
76578
|
+
}
|
|
76579
|
+
if (links.instantiationExpressionTypes.has(exprType.id)) {
|
|
76580
|
+
return links.instantiationExpressionTypes.get(exprType.id);
|
|
76581
|
+
}
|
|
76487
76582
|
let hasSomeApplicableSignature = false;
|
|
76488
76583
|
let nonApplicableType;
|
|
76489
76584
|
const result = getInstantiatedType(exprType);
|
|
76585
|
+
links.instantiationExpressionTypes.set(exprType.id, result);
|
|
76490
76586
|
const errorType2 = hasSomeApplicableSignature ? nonApplicableType : exprType;
|
|
76491
76587
|
if (errorType2) {
|
|
76492
76588
|
diagnostics.add(createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable, typeToString(errorType2)));
|
|
@@ -79955,15 +80051,17 @@ function createTypeChecker(host) {
|
|
|
79955
80051
|
if (indexSymbol == null ? void 0 : indexSymbol.declarations) {
|
|
79956
80052
|
const indexSignatureMap = /* @__PURE__ */ new Map();
|
|
79957
80053
|
for (const declaration of indexSymbol.declarations) {
|
|
79958
|
-
if (declaration
|
|
79959
|
-
|
|
79960
|
-
|
|
79961
|
-
|
|
79962
|
-
entry
|
|
79963
|
-
|
|
79964
|
-
|
|
79965
|
-
|
|
79966
|
-
|
|
80054
|
+
if (isIndexSignatureDeclaration(declaration)) {
|
|
80055
|
+
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
80056
|
+
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), (type) => {
|
|
80057
|
+
const entry = indexSignatureMap.get(getTypeId(type));
|
|
80058
|
+
if (entry) {
|
|
80059
|
+
entry.declarations.push(declaration);
|
|
80060
|
+
} else {
|
|
80061
|
+
indexSignatureMap.set(getTypeId(type), { type, declarations: [declaration] });
|
|
80062
|
+
}
|
|
80063
|
+
});
|
|
80064
|
+
}
|
|
79967
80065
|
}
|
|
79968
80066
|
}
|
|
79969
80067
|
indexSignatureMap.forEach((entry) => {
|
|
@@ -84537,6 +84635,7 @@ function createTypeChecker(host) {
|
|
|
84537
84635
|
grammarErrorOnFirstToken(node, Diagnostics.An_import_declaration_cannot_have_modifiers);
|
|
84538
84636
|
}
|
|
84539
84637
|
if (checkExternalImportOrExportDeclaration(node)) {
|
|
84638
|
+
let resolvedModule;
|
|
84540
84639
|
const importClause = node.importClause;
|
|
84541
84640
|
if (importClause && !checkGrammarImportClause(importClause)) {
|
|
84542
84641
|
if (importClause.name) {
|
|
@@ -84549,18 +84648,27 @@ function createTypeChecker(host) {
|
|
|
84549
84648
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
84550
84649
|
}
|
|
84551
84650
|
} else {
|
|
84552
|
-
|
|
84553
|
-
if (
|
|
84651
|
+
resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);
|
|
84652
|
+
if (resolvedModule) {
|
|
84554
84653
|
forEach(importClause.namedBindings.elements, checkImportBinding);
|
|
84555
84654
|
}
|
|
84556
84655
|
}
|
|
84557
84656
|
}
|
|
84657
|
+
if (isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) {
|
|
84658
|
+
error(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]);
|
|
84659
|
+
}
|
|
84558
84660
|
} else if (noUncheckedSideEffectImports && !importClause) {
|
|
84559
84661
|
void resolveExternalModuleName(node, node.moduleSpecifier);
|
|
84560
84662
|
}
|
|
84561
84663
|
}
|
|
84562
84664
|
checkImportAttributes(node);
|
|
84563
84665
|
}
|
|
84666
|
+
function hasTypeJsonImportAttribute(node) {
|
|
84667
|
+
return !!node.attributes && node.attributes.elements.some((attr) => {
|
|
84668
|
+
var _a;
|
|
84669
|
+
return getTextOfIdentifierOrLiteral(attr.name) === "type" && ((_a = tryCast(attr.value, isStringLiteralLike)) == null ? void 0 : _a.text) === "json";
|
|
84670
|
+
});
|
|
84671
|
+
}
|
|
84564
84672
|
function checkImportEqualsDeclaration(node) {
|
|
84565
84673
|
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)) {
|
|
84566
84674
|
return;
|
|
@@ -85677,7 +85785,7 @@ function createTypeChecker(host) {
|
|
|
85677
85785
|
} else if (isJSDocMemberName(name)) {
|
|
85678
85786
|
return resolveJSDocMemberName(name);
|
|
85679
85787
|
}
|
|
85680
|
-
} else if (isTypeReferenceIdentifier(name)) {
|
|
85788
|
+
} else if (isEntityName(name) && isTypeReferenceIdentifier(name)) {
|
|
85681
85789
|
const meaning = name.parent.kind === 183 /* TypeReference */ ? 788968 /* Type */ : 1920 /* Namespace */;
|
|
85682
85790
|
const symbol = resolveEntityName(
|
|
85683
85791
|
name,
|
|
@@ -86871,7 +86979,29 @@ function createTypeChecker(host) {
|
|
|
86871
86979
|
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, internalFlags, tracker);
|
|
86872
86980
|
},
|
|
86873
86981
|
isImportRequiredByAugmentation,
|
|
86874
|
-
isDefinitelyReferenceToGlobalSymbolObject
|
|
86982
|
+
isDefinitelyReferenceToGlobalSymbolObject,
|
|
86983
|
+
createLateBoundIndexSignatures: (cls, enclosing, flags, internalFlags, tracker) => {
|
|
86984
|
+
const sym = cls.symbol;
|
|
86985
|
+
const staticInfos = getIndexInfosOfType(getTypeOfSymbol(sym));
|
|
86986
|
+
const instanceIndexSymbol = getIndexSymbol(sym);
|
|
86987
|
+
const instanceInfos = instanceIndexSymbol && getIndexInfosOfIndexSymbol(instanceIndexSymbol, arrayFrom(getMembersOfSymbol(sym).values()));
|
|
86988
|
+
let result;
|
|
86989
|
+
for (const infoList of [staticInfos, instanceInfos]) {
|
|
86990
|
+
if (!length(infoList)) continue;
|
|
86991
|
+
result || (result = []);
|
|
86992
|
+
for (const info of infoList) {
|
|
86993
|
+
if (info.declaration) continue;
|
|
86994
|
+
const node = nodeBuilder.indexInfoToIndexSignatureDeclaration(info, enclosing, flags, internalFlags, tracker);
|
|
86995
|
+
if (node && infoList === staticInfos) {
|
|
86996
|
+
(node.modifiers || (node.modifiers = factory.createNodeArray())).unshift(factory.createModifier(126 /* StaticKeyword */));
|
|
86997
|
+
}
|
|
86998
|
+
if (node) {
|
|
86999
|
+
result.push(node);
|
|
87000
|
+
}
|
|
87001
|
+
}
|
|
87002
|
+
}
|
|
87003
|
+
return result;
|
|
87004
|
+
}
|
|
86875
87005
|
};
|
|
86876
87006
|
function isImportRequiredByAugmentation(node) {
|
|
86877
87007
|
const file = getSourceFileOfNode(node);
|
|
@@ -113356,7 +113486,8 @@ function transformDeclarations(context) {
|
|
|
113356
113486
|
void 0
|
|
113357
113487
|
)
|
|
113358
113488
|
] : void 0;
|
|
113359
|
-
const
|
|
113489
|
+
const lateIndexes = resolver.createLateBoundIndexSignatures(input, enclosingDeclaration, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
|
|
113490
|
+
const memberNodes = concatenate(concatenate(concatenate(privateIdentifier, lateIndexes), parameterProperties), visitNodes2(input.members, visitDeclarationSubtree, isClassElement));
|
|
113360
113491
|
const members = factory2.createNodeArray(memberNodes);
|
|
113361
113492
|
const extendsClause = getEffectiveBaseTypeNode(input);
|
|
113362
113493
|
if (extendsClause && !isEntityNameExpression(extendsClause.expression) && extendsClause.expression.kind !== 106 /* NullKeyword */) {
|
|
@@ -114661,7 +114792,8 @@ var notImplementedResolver = {
|
|
|
114661
114792
|
isBindingCapturedByNode: notImplemented,
|
|
114662
114793
|
getDeclarationStatementsForSourceFile: notImplemented,
|
|
114663
114794
|
isImportRequiredByAugmentation: notImplemented,
|
|
114664
|
-
isDefinitelyReferenceToGlobalSymbolObject: notImplemented
|
|
114795
|
+
isDefinitelyReferenceToGlobalSymbolObject: notImplemented,
|
|
114796
|
+
createLateBoundIndexSignatures: notImplemented
|
|
114665
114797
|
};
|
|
114666
114798
|
var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
|
|
114667
114799
|
var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
|
|
@@ -120815,7 +120947,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120815
120947
|
return (_a2 = resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.get(file.path)) == null ? void 0 : _a2.get(typeDirectiveName, mode);
|
|
120816
120948
|
}
|
|
120817
120949
|
function getResolvedTypeReferenceDirectiveFromTypeReferenceDirective(typeRef, sourceFile) {
|
|
120818
|
-
return getResolvedTypeReferenceDirective(
|
|
120950
|
+
return getResolvedTypeReferenceDirective(
|
|
120951
|
+
sourceFile,
|
|
120952
|
+
typeRef.fileName,
|
|
120953
|
+
getModeForTypeReferenceDirectiveInFile(typeRef, sourceFile)
|
|
120954
|
+
);
|
|
120819
120955
|
}
|
|
120820
120956
|
function forEachResolvedModule(callback, file) {
|
|
120821
120957
|
forEachResolution(resolvedModules, callback, file);
|
|
@@ -121202,10 +121338,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121202
121338
|
const moduleNames = getModuleNames(newSourceFile);
|
|
121203
121339
|
const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
121204
121340
|
(resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
|
|
121341
|
+
const optionsForFile = getCompilerOptionsForFile(newSourceFile);
|
|
121205
121342
|
const resolutionsChanged = hasChangesInResolutions(
|
|
121206
121343
|
moduleNames,
|
|
121207
121344
|
resolutions,
|
|
121208
|
-
(name) => oldProgram.getResolvedModule(newSourceFile, name.text,
|
|
121345
|
+
(name) => oldProgram.getResolvedModule(newSourceFile, name.text, getModeForUsageLocationWorker(newSourceFile, name, optionsForFile)),
|
|
121209
121346
|
moduleResolutionIsEqualTo
|
|
121210
121347
|
);
|
|
121211
121348
|
if (resolutionsChanged) structureIsReused = 1 /* SafeModules */;
|
|
@@ -121215,7 +121352,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121215
121352
|
const typeReferenceResolutionsChanged = hasChangesInResolutions(
|
|
121216
121353
|
typesReferenceDirectives,
|
|
121217
121354
|
typeReferenceResolutions,
|
|
121218
|
-
(name) => oldProgram.getResolvedTypeReferenceDirective(
|
|
121355
|
+
(name) => oldProgram.getResolvedTypeReferenceDirective(
|
|
121356
|
+
newSourceFile,
|
|
121357
|
+
getTypeReferenceResolutionName(name),
|
|
121358
|
+
getModeForTypeReferenceDirectiveInFile(name, newSourceFile)
|
|
121359
|
+
),
|
|
121219
121360
|
typeDirectiveIsEqualTo
|
|
121220
121361
|
);
|
|
121221
121362
|
if (typeReferenceResolutionsChanged) structureIsReused = 1 /* SafeModules */;
|
|
@@ -122376,8 +122517,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122376
122517
|
const ref = file.typeReferenceDirectives[index];
|
|
122377
122518
|
const resolvedTypeReferenceDirective = resolutions[index];
|
|
122378
122519
|
const fileName = ref.fileName;
|
|
122379
|
-
|
|
122380
|
-
|
|
122520
|
+
const mode = getModeForTypeReferenceDirectiveInFile(ref, file);
|
|
122521
|
+
resolutionsInFile.set(fileName, mode, resolvedTypeReferenceDirective);
|
|
122381
122522
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
122382
122523
|
}
|
|
122383
122524
|
}
|
|
@@ -123421,6 +123562,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123421
123562
|
function shouldTransformImportCall(sourceFile) {
|
|
123422
123563
|
return shouldTransformImportCallWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
123423
123564
|
}
|
|
123565
|
+
function getModeForTypeReferenceDirectiveInFile(ref, sourceFile) {
|
|
123566
|
+
return ref.resolutionMode || getDefaultResolutionModeForFile2(sourceFile);
|
|
123567
|
+
}
|
|
123424
123568
|
}
|
|
123425
123569
|
function shouldTransformImportCallWorker(sourceFile, options) {
|
|
123426
123570
|
const moduleKind = getEmitModuleKind(options);
|
package/lib/typescript.d.ts
CHANGED
|
@@ -6140,7 +6140,7 @@ declare namespace ts {
|
|
|
6140
6140
|
getPrivateIdentifierPropertyOfType(leftType: Type, name: string, location: Node): Symbol | undefined;
|
|
6141
6141
|
getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo | undefined;
|
|
6142
6142
|
getIndexInfosOfType(type: Type): readonly IndexInfo[];
|
|
6143
|
-
getIndexInfosOfIndexSymbol: (indexSymbol: Symbol) => IndexInfo[];
|
|
6143
|
+
getIndexInfosOfIndexSymbol: (indexSymbol: Symbol, siblingSymbols?: Symbol[] | undefined) => IndexInfo[];
|
|
6144
6144
|
getSignaturesOfType(type: Type, kind: SignatureKind): readonly Signature[];
|
|
6145
6145
|
getIndexTypeOfType(type: Type, kind: IndexKind): Type | undefined;
|
|
6146
6146
|
getBaseTypes(type: InterfaceType): BaseType[];
|