typescript 5.8.0-dev.20250123 → 5.8.0-dev.20250125
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/_tsc.js +188 -25
- package/lib/typescript.d.ts +7 -0
- package/lib/typescript.js +208 -39
- 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.8";
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20250125`;
|
22
22
|
|
23
23
|
// src/compiler/core.ts
|
24
24
|
var emptyArray = [];
|
@@ -6021,6 +6021,7 @@ var Diagnostics = {
|
|
6021
6021
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1291, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1291", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
|
6022
6022
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1292, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1292", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
|
6023
6023
|
ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve: diag(1293, 1 /* Error */, "ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293", "ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'."),
|
6024
|
+
This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled: diag(1294, 1 /* Error */, "This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled_1294", "This syntax is not allowed when 'erasableSyntaxOnly' is enabled."),
|
6024
6025
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, 1 /* Error */, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
6025
6026
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, 1 /* Error */, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
6026
6027
|
The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, 1 /* Error */, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
|
@@ -7508,11 +7509,13 @@ var Diagnostics = {
|
|
7508
7509
|
Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
|
7509
7510
|
Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files: diag(6719, 3 /* Message */, "Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files_6719", "Require sufficient annotation on exports so other tools can trivially generate declaration files."),
|
7510
7511
|
Built_in_iterators_are_instantiated_with_a_TReturn_type_of_undefined_instead_of_any: diag(6720, 3 /* Message */, "Built_in_iterators_are_instantiated_with_a_TReturn_type_of_undefined_instead_of_any_6720", "Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'."),
|
7512
|
+
Do_not_allow_runtime_constructs_that_are_not_part_of_ECMAScript: diag(6721, 3 /* Message */, "Do_not_allow_runtime_constructs_that_are_not_part_of_ECMAScript_6721", "Do not allow runtime constructs that are not part of ECMAScript."),
|
7511
7513
|
Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
|
7512
7514
|
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
|
7513
7515
|
Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported: diag(6805, 3 /* Message */, "Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported_6805", "Disable full type checking (only critical parse and emit errors will be reported)."),
|
7514
7516
|
Check_side_effect_imports: diag(6806, 3 /* Message */, "Check_side_effect_imports_6806", "Check side effect imports."),
|
7515
7517
|
This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2: diag(6807, 1 /* Error */, "This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2_6807", "This operation can be simplified. This shift is identical to `{0} {1} {2}`."),
|
7518
|
+
Enable_lib_replacement: diag(6808, 3 /* Message */, "Enable_lib_replacement_6808", "Enable lib replacement."),
|
7516
7519
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
7517
7520
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
7518
7521
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
@@ -36847,6 +36850,23 @@ var commandOptionsWithoutBuild = [
|
|
36847
36850
|
affectsBuildInfo: true,
|
36848
36851
|
affectsSemanticDiagnostics: true
|
36849
36852
|
},
|
36853
|
+
{
|
36854
|
+
name: "erasableSyntaxOnly",
|
36855
|
+
type: "boolean",
|
36856
|
+
category: Diagnostics.Interop_Constraints,
|
36857
|
+
description: Diagnostics.Do_not_allow_runtime_constructs_that_are_not_part_of_ECMAScript,
|
36858
|
+
defaultValueDescription: false,
|
36859
|
+
affectsBuildInfo: true,
|
36860
|
+
affectsSemanticDiagnostics: true
|
36861
|
+
},
|
36862
|
+
{
|
36863
|
+
name: "libReplacement",
|
36864
|
+
type: "boolean",
|
36865
|
+
affectsProgramStructure: true,
|
36866
|
+
category: Diagnostics.Language_and_Environment,
|
36867
|
+
description: Diagnostics.Enable_lib_replacement,
|
36868
|
+
defaultValueDescription: true
|
36869
|
+
},
|
36850
36870
|
// Strict Type Checks
|
36851
36871
|
{
|
36852
36872
|
name: "strict",
|
@@ -41303,6 +41323,7 @@ function hasOneAsterisk(patternKey) {
|
|
41303
41323
|
function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
|
41304
41324
|
return loadModuleFromTargetExportOrImport;
|
41305
41325
|
function loadModuleFromTargetExportOrImport(target, subpath, pattern, key) {
|
41326
|
+
var _a, _b;
|
41306
41327
|
if (typeof target === "string") {
|
41307
41328
|
if (!pattern && subpath.length > 0 && !endsWith(target, "/")) {
|
41308
41329
|
if (state.traceEnabled) {
|
@@ -41331,6 +41352,8 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
|
|
41331
41352
|
redirectedReference,
|
41332
41353
|
state.conditions
|
41333
41354
|
);
|
41355
|
+
(_a = state.failedLookupLocations) == null ? void 0 : _a.push(...result.failedLookupLocations ?? emptyArray);
|
41356
|
+
(_b = state.affectingLocations) == null ? void 0 : _b.push(...result.affectingLocations ?? emptyArray);
|
41334
41357
|
return toSearchResult(
|
41335
41358
|
result.resolvedModule ? {
|
41336
41359
|
path: result.resolvedModule.resolvedFileName,
|
@@ -41440,20 +41463,20 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
|
|
41440
41463
|
void 0
|
41441
41464
|
);
|
41442
41465
|
function toAbsolutePath(path) {
|
41443
|
-
var
|
41466
|
+
var _a2, _b2;
|
41444
41467
|
if (path === void 0) return path;
|
41445
|
-
return getNormalizedAbsolutePath(path, (
|
41468
|
+
return getNormalizedAbsolutePath(path, (_b2 = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b2.call(_a2));
|
41446
41469
|
}
|
41447
41470
|
function combineDirectoryPath(root, dir) {
|
41448
41471
|
return ensureTrailingDirectorySeparator(combinePaths(root, dir));
|
41449
41472
|
}
|
41450
41473
|
function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports2) {
|
41451
|
-
var
|
41474
|
+
var _a2, _b2, _c, _d;
|
41452
41475
|
if (!state.isConfigLookup && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && !finalPath.includes("/node_modules/") && (state.compilerOptions.configFile ? containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames(state)) : true)) {
|
41453
41476
|
const getCanonicalFileName = hostGetCanonicalFileName({ useCaseSensitiveFileNames: () => useCaseSensitiveFileNames(state) });
|
41454
41477
|
const commonSourceDirGuesses = [];
|
41455
41478
|
if (state.compilerOptions.rootDir || state.compilerOptions.composite && state.compilerOptions.configFilePath) {
|
41456
|
-
const commonDir = toAbsolutePath(getCommonSourceDirectory(state.compilerOptions, () => [], ((
|
41479
|
+
const commonDir = toAbsolutePath(getCommonSourceDirectory(state.compilerOptions, () => [], ((_b2 = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b2.call(_a2)) || "", getCanonicalFileName));
|
41457
41480
|
commonSourceDirGuesses.push(commonDir);
|
41458
41481
|
} else if (state.requestContainingDirectory) {
|
41459
41482
|
const requestingFile = toAbsolutePath(combinePaths(state.requestContainingDirectory, "index.ts"));
|
@@ -41509,8 +41532,8 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
|
|
41509
41532
|
}
|
41510
41533
|
return void 0;
|
41511
41534
|
function getOutputDirectoriesForBaseDirectory(commonSourceDirGuess) {
|
41512
|
-
var
|
41513
|
-
const currentDir = state.compilerOptions.configFile ? ((
|
41535
|
+
var _a3, _b3;
|
41536
|
+
const currentDir = state.compilerOptions.configFile ? ((_b3 = (_a3 = state.host).getCurrentDirectory) == null ? void 0 : _b3.call(_a3)) || "" : commonSourceDirGuess;
|
41514
41537
|
const candidateDirectories = [];
|
41515
41538
|
if (state.compilerOptions.declarationDir) {
|
41516
41539
|
candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.declarationDir)));
|
@@ -46588,8 +46611,13 @@ function createTypeChecker(host) {
|
|
46588
46611
|
getMemberOverrideModifierStatus,
|
46589
46612
|
isTypeParameterPossiblyReferenced,
|
46590
46613
|
typeHasCallOrConstructSignatures,
|
46591
|
-
getSymbolFlags
|
46614
|
+
getSymbolFlags,
|
46615
|
+
getTypeArgumentsForResolvedSignature
|
46592
46616
|
};
|
46617
|
+
function getTypeArgumentsForResolvedSignature(signature) {
|
46618
|
+
if (signature.mapper === void 0) return void 0;
|
46619
|
+
return instantiateTypes((signature.target || signature).typeParameters, signature.mapper);
|
46620
|
+
}
|
46593
46621
|
function getCandidateSignaturesForStringLiteralCompletions(call, editingArgument) {
|
46594
46622
|
const candidatesSet = /* @__PURE__ */ new Set();
|
46595
46623
|
const candidates = [];
|
@@ -51229,7 +51257,7 @@ function createTypeChecker(host) {
|
|
51229
51257
|
function shouldWriteTypeOfFunctionSymbol() {
|
51230
51258
|
var _a3;
|
51231
51259
|
const isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */) && // typeof static method
|
51232
|
-
some(symbol.declarations, (declaration) => isStatic(declaration));
|
51260
|
+
some(symbol.declarations, (declaration) => isStatic(declaration) && !isLateBindableIndexSignature(getNameOfDeclaration(declaration)));
|
51233
51261
|
const isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol
|
51234
51262
|
forEach(symbol.declarations, (declaration) => declaration.parent.kind === 307 /* SourceFile */ || declaration.parent.kind === 268 /* ModuleBlock */));
|
51235
51263
|
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
|
@@ -51532,6 +51560,38 @@ function createTypeChecker(host) {
|
|
51532
51560
|
ids.unshift(state);
|
51533
51561
|
return ids;
|
51534
51562
|
}
|
51563
|
+
function indexInfoToObjectComputedNamesOrSignatureDeclaration(indexInfo, context2, typeNode) {
|
51564
|
+
if (indexInfo.components) {
|
51565
|
+
const allComponentComputedNamesSerializable = every(indexInfo.components, (e) => {
|
51566
|
+
var _a2;
|
51567
|
+
return !!(e.name && isComputedPropertyName(e.name) && isEntityNameExpression(e.name.expression) && context2.enclosingDeclaration && ((_a2 = isEntityNameVisible(
|
51568
|
+
e.name.expression,
|
51569
|
+
context2.enclosingDeclaration,
|
51570
|
+
/*shouldComputeAliasToMakeVisible*/
|
51571
|
+
false
|
51572
|
+
)) == null ? void 0 : _a2.accessibility) === 0 /* Accessible */);
|
51573
|
+
});
|
51574
|
+
if (allComponentComputedNamesSerializable) {
|
51575
|
+
const newComponents = filter(indexInfo.components, (e) => {
|
51576
|
+
return !hasLateBindableName(e);
|
51577
|
+
});
|
51578
|
+
return map(newComponents, (e) => {
|
51579
|
+
trackComputedName(e.name.expression, context2.enclosingDeclaration, context2);
|
51580
|
+
return setTextRange2(
|
51581
|
+
context2,
|
51582
|
+
factory.createPropertySignature(
|
51583
|
+
indexInfo.isReadonly ? [factory.createModifier(148 /* ReadonlyKeyword */)] : void 0,
|
51584
|
+
e.name,
|
51585
|
+
(isPropertySignature(e) || isPropertyDeclaration(e) || isMethodSignature(e) || isMethodDeclaration(e) || isGetAccessor(e) || isSetAccessor(e)) && e.questionToken ? factory.createToken(58 /* QuestionToken */) : void 0,
|
51586
|
+
typeNode || typeToTypeNodeHelper(getTypeOfSymbol(e.symbol), context2)
|
51587
|
+
),
|
51588
|
+
e
|
51589
|
+
);
|
51590
|
+
});
|
51591
|
+
}
|
51592
|
+
}
|
51593
|
+
return [indexInfoToIndexSignatureDeclarationHelper(indexInfo, context2, typeNode)];
|
51594
|
+
}
|
51535
51595
|
function createTypeNodesFromResolvedType(resolvedType) {
|
51536
51596
|
if (checkTruncationLength(context)) {
|
51537
51597
|
if (context.flags & 1 /* NoTruncation */) {
|
@@ -51556,7 +51616,7 @@ function createTypeChecker(host) {
|
|
51556
51616
|
typeElements.push(signatureToSignatureDeclarationHelper(signature, 180 /* ConstructSignature */, context));
|
51557
51617
|
}
|
51558
51618
|
for (const info of resolvedType.indexInfos) {
|
51559
|
-
typeElements.push(
|
51619
|
+
typeElements.push(...indexInfoToObjectComputedNamesOrSignatureDeclaration(info, context, resolvedType.objectFlags & 1024 /* ReverseMapped */ ? createElidedInformationPlaceholder(context) : void 0));
|
51560
51620
|
}
|
51561
51621
|
const properties = resolvedType.properties;
|
51562
51622
|
if (!properties) {
|
@@ -52245,7 +52305,7 @@ function createTypeChecker(host) {
|
|
52245
52305
|
if (!context.tracker.canTrackSymbol) return;
|
52246
52306
|
const firstIdentifier = getFirstIdentifier(accessExpression);
|
52247
52307
|
const name = resolveName(
|
52248
|
-
|
52308
|
+
enclosingDeclaration,
|
52249
52309
|
firstIdentifier.escapedText,
|
52250
52310
|
111551 /* Value */ | 1048576 /* ExportValue */,
|
52251
52311
|
/*nameNotFoundMessage*/
|
@@ -52255,6 +52315,19 @@ function createTypeChecker(host) {
|
|
52255
52315
|
);
|
52256
52316
|
if (name) {
|
52257
52317
|
context.tracker.trackSymbol(name, enclosingDeclaration, 111551 /* Value */);
|
52318
|
+
} else {
|
52319
|
+
const fallback = resolveName(
|
52320
|
+
firstIdentifier,
|
52321
|
+
firstIdentifier.escapedText,
|
52322
|
+
111551 /* Value */ | 1048576 /* ExportValue */,
|
52323
|
+
/*nameNotFoundMessage*/
|
52324
|
+
void 0,
|
52325
|
+
/*isUse*/
|
52326
|
+
true
|
52327
|
+
);
|
52328
|
+
if (fallback) {
|
52329
|
+
context.tracker.trackSymbol(fallback, enclosingDeclaration, 111551 /* Value */);
|
52330
|
+
}
|
52258
52331
|
}
|
52259
52332
|
}
|
52260
52333
|
function lookupSymbolChain(symbol, context, meaning, yieldModuleSymbol) {
|
@@ -59069,8 +59142,8 @@ function createTypeChecker(host) {
|
|
59069
59142
|
function getIndexSymbolFromSymbolTable(symbolTable) {
|
59070
59143
|
return symbolTable.get("__index" /* Index */);
|
59071
59144
|
}
|
59072
|
-
function createIndexInfo(keyType, type, isReadonly, declaration) {
|
59073
|
-
return { keyType, type, isReadonly, declaration };
|
59145
|
+
function createIndexInfo(keyType, type, isReadonly, declaration, components) {
|
59146
|
+
return { keyType, type, isReadonly, declaration, components };
|
59074
59147
|
}
|
59075
59148
|
function getIndexInfosOfSymbol(symbol) {
|
59076
59149
|
const indexSymbol = getIndexSymbol(symbol);
|
@@ -62146,7 +62219,7 @@ function createTypeChecker(host) {
|
|
62146
62219
|
return result;
|
62147
62220
|
}
|
62148
62221
|
function getIndexInfoWithReadonly(info, readonly) {
|
62149
|
-
return info.isReadonly !== readonly ? createIndexInfo(info.keyType, info.type, readonly, info.declaration) : info;
|
62222
|
+
return info.isReadonly !== readonly ? createIndexInfo(info.keyType, info.type, readonly, info.declaration, info.components) : info;
|
62150
62223
|
}
|
62151
62224
|
function createLiteralType(flags, value, symbol, regularType) {
|
62152
62225
|
const type = createTypeWithSymbol(flags, symbol);
|
@@ -62936,7 +63009,7 @@ function createTypeChecker(host) {
|
|
62936
63009
|
return type.restrictiveInstantiation;
|
62937
63010
|
}
|
62938
63011
|
function instantiateIndexInfo(info, mapper) {
|
62939
|
-
return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration);
|
63012
|
+
return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration, info.components);
|
62940
63013
|
}
|
62941
63014
|
function isContextSensitive(node) {
|
62942
63015
|
Debug.assert(node.kind !== 174 /* MethodDeclaration */ || isObjectLiteralMethod(node));
|
@@ -67069,7 +67142,7 @@ function createTypeChecker(host) {
|
|
67069
67142
|
}
|
67070
67143
|
}
|
67071
67144
|
}
|
67072
|
-
const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, sameMap(getIndexInfosOfType(type), (info) => createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly)));
|
67145
|
+
const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, sameMap(getIndexInfosOfType(type), (info) => createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly, info.declaration, info.components)));
|
67073
67146
|
result.objectFlags |= getObjectFlags(type) & (4096 /* JSLiteral */ | 262144 /* NonInferrableType */);
|
67074
67147
|
return result;
|
67075
67148
|
}
|
@@ -73119,16 +73192,33 @@ function createTypeChecker(host) {
|
|
73119
73192
|
const firstDecl = (_a = symbol.declarations) == null ? void 0 : _a[0];
|
73120
73193
|
return isKnownSymbol(symbol) || firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 4096 /* ESSymbol */);
|
73121
73194
|
}
|
73195
|
+
function isSymbolWithComputedName(symbol) {
|
73196
|
+
var _a;
|
73197
|
+
const firstDecl = (_a = symbol.declarations) == null ? void 0 : _a[0];
|
73198
|
+
return firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name);
|
73199
|
+
}
|
73122
73200
|
function getObjectLiteralIndexInfo(isReadonly, offset, properties, keyType) {
|
73201
|
+
var _a;
|
73123
73202
|
const propTypes = [];
|
73203
|
+
let components;
|
73124
73204
|
for (let i = offset; i < properties.length; i++) {
|
73125
73205
|
const prop = properties[i];
|
73126
73206
|
if (keyType === stringType && !isSymbolWithSymbolName(prop) || keyType === numberType && isSymbolWithNumericName(prop) || keyType === esSymbolType && isSymbolWithSymbolName(prop)) {
|
73127
73207
|
propTypes.push(getTypeOfSymbol(properties[i]));
|
73208
|
+
if (isSymbolWithComputedName(properties[i])) {
|
73209
|
+
components = append(components, (_a = properties[i].declarations) == null ? void 0 : _a[0]);
|
73210
|
+
}
|
73128
73211
|
}
|
73129
73212
|
}
|
73130
73213
|
const unionType = propTypes.length ? getUnionType(propTypes, 2 /* Subtype */) : undefinedType;
|
73131
|
-
return createIndexInfo(
|
73214
|
+
return createIndexInfo(
|
73215
|
+
keyType,
|
73216
|
+
unionType,
|
73217
|
+
isReadonly,
|
73218
|
+
/*declaration*/
|
73219
|
+
void 0,
|
73220
|
+
components
|
73221
|
+
);
|
73132
73222
|
}
|
73133
73223
|
function getImmediateAliasedSymbol(symbol) {
|
73134
73224
|
Debug.assert((symbol.flags & 2097152 /* Alias */) !== 0, "Should only get Alias here.");
|
@@ -73663,6 +73753,9 @@ function createTypeChecker(host) {
|
|
73663
73753
|
return getNameFromJsxElementAttributesContainer(JsxNames.ElementAttributesPropertyNameContainer, jsxNamespace);
|
73664
73754
|
}
|
73665
73755
|
function getJsxElementChildrenPropertyName(jsxNamespace) {
|
73756
|
+
if (compilerOptions.jsx === 4 /* ReactJSX */ || compilerOptions.jsx === 5 /* ReactJSXDev */) {
|
73757
|
+
return "children";
|
73758
|
+
}
|
73666
73759
|
return getNameFromJsxElementAttributesContainer(JsxNames.ElementChildrenAttributeNameContainer, jsxNamespace);
|
73667
73760
|
}
|
73668
73761
|
function getUninstantiatedJsxSignaturesOfType(elementType, caller) {
|
@@ -80174,6 +80267,9 @@ function createTypeChecker(host) {
|
|
80174
80267
|
checkVariableLikeDeclaration(node);
|
80175
80268
|
const func = getContainingFunction(node);
|
80176
80269
|
if (hasSyntacticModifier(node, 31 /* ParameterPropertyModifier */)) {
|
80270
|
+
if (compilerOptions.erasableSyntaxOnly) {
|
80271
|
+
error(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
80272
|
+
}
|
80177
80273
|
if (!(func.kind === 176 /* Constructor */ && nodeIsPresent(func.body))) {
|
80178
80274
|
error(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
|
80179
80275
|
}
|
@@ -83828,7 +83924,7 @@ function createTypeChecker(host) {
|
|
83828
83924
|
const typeDeclaration = symbol.valueDeclaration;
|
83829
83925
|
if (typeDeclaration && isClassLike(typeDeclaration)) {
|
83830
83926
|
for (const member of typeDeclaration.members) {
|
83831
|
-
if (!isStatic(member) && !hasBindableName(member)) {
|
83927
|
+
if ((!isStaticIndex && !isStatic(member) || isStaticIndex && isStatic(member)) && !hasBindableName(member)) {
|
83832
83928
|
const symbol2 = getSymbolOfDeclaration(member);
|
83833
83929
|
checkIndexConstraintForProperty(type, symbol2, getTypeOfExpression(member.name.expression), getNonMissingTypeOfSymbol(symbol2));
|
83834
83930
|
}
|
@@ -84878,6 +84974,9 @@ function createTypeChecker(host) {
|
|
84878
84974
|
checkCollisionsForDeclarationName(node, node.name);
|
84879
84975
|
checkExportsOnMergedDeclarations(node);
|
84880
84976
|
node.members.forEach(checkEnumMember);
|
84977
|
+
if (compilerOptions.erasableSyntaxOnly && !(node.flags & 33554432 /* Ambient */)) {
|
84978
|
+
error(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
84979
|
+
}
|
84881
84980
|
computeEnumMemberValues(node);
|
84882
84981
|
const enumSymbol = getSymbolOfDeclaration(node);
|
84883
84982
|
const firstDeclaration = getDeclarationOfKind(enumSymbol, node.kind);
|
@@ -84979,6 +85078,9 @@ function createTypeChecker(host) {
|
|
84979
85078
|
checkExportsOnMergedDeclarations(node);
|
84980
85079
|
const symbol = getSymbolOfDeclaration(node);
|
84981
85080
|
if (symbol.flags & 512 /* ValueModule */ && !inAmbientContext && isInstantiatedModule(node, shouldPreserveConstEnums(compilerOptions))) {
|
85081
|
+
if (compilerOptions.erasableSyntaxOnly) {
|
85082
|
+
error(node.name, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
85083
|
+
}
|
84982
85084
|
if (getIsolatedModules(compilerOptions) && !getSourceFileOfNode(node).externalModuleIndicator) {
|
84983
85085
|
error(node.name, Diagnostics.Namespaces_are_not_allowed_in_global_script_files_when_0_is_enabled_If_this_file_is_not_intended_to_be_a_global_script_set_moduleDetection_to_force_or_add_an_empty_export_statement, isolatedModulesLikeFlagName);
|
84984
85086
|
}
|
@@ -85366,7 +85468,11 @@ function createTypeChecker(host) {
|
|
85366
85468
|
return;
|
85367
85469
|
}
|
85368
85470
|
checkGrammarModifiers(node);
|
85369
|
-
|
85471
|
+
const isImportEquals = isInternalModuleImportEqualsDeclaration(node);
|
85472
|
+
if (compilerOptions.erasableSyntaxOnly && isImportEquals && !(node.flags & 33554432 /* Ambient */)) {
|
85473
|
+
error(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
85474
|
+
}
|
85475
|
+
if (isImportEquals || checkExternalImportOrExportDeclaration(node)) {
|
85370
85476
|
checkImportBinding(node);
|
85371
85477
|
markLinkedReferences(node, 6 /* ExportImportEquals */);
|
85372
85478
|
if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
|
@@ -87631,6 +87737,35 @@ function createTypeChecker(host) {
|
|
87631
87737
|
for (const info of infoList) {
|
87632
87738
|
if (info.declaration) continue;
|
87633
87739
|
if (info === anyBaseTypeIndexInfo) continue;
|
87740
|
+
if (info.components) {
|
87741
|
+
const allComponentComputedNamesSerializable = every(info.components, (e) => {
|
87742
|
+
var _a;
|
87743
|
+
return !!(e.name && isComputedPropertyName(e.name) && isEntityNameExpression(e.name.expression) && enclosing && ((_a = isEntityNameVisible(
|
87744
|
+
e.name.expression,
|
87745
|
+
enclosing,
|
87746
|
+
/*shouldComputeAliasToMakeVisible*/
|
87747
|
+
false
|
87748
|
+
)) == null ? void 0 : _a.accessibility) === 0 /* Accessible */);
|
87749
|
+
});
|
87750
|
+
if (allComponentComputedNamesSerializable) {
|
87751
|
+
const newComponents = filter(info.components, (e) => {
|
87752
|
+
return !hasLateBindableName(e);
|
87753
|
+
});
|
87754
|
+
result.push(...map(newComponents, (e) => {
|
87755
|
+
trackComputedName(e.name.expression);
|
87756
|
+
const mods = infoList === staticInfos ? [factory.createModifier(126 /* StaticKeyword */)] : void 0;
|
87757
|
+
return factory.createPropertyDeclaration(
|
87758
|
+
append(mods, info.isReadonly ? factory.createModifier(148 /* ReadonlyKeyword */) : void 0),
|
87759
|
+
e.name,
|
87760
|
+
(isPropertySignature(e) || isPropertyDeclaration(e) || isMethodSignature(e) || isMethodDeclaration(e) || isGetAccessor(e) || isSetAccessor(e)) && e.questionToken ? factory.createToken(58 /* QuestionToken */) : void 0,
|
87761
|
+
nodeBuilder.typeToTypeNode(getTypeOfSymbol(e.symbol), enclosing, flags, internalFlags, tracker),
|
87762
|
+
/*initializer*/
|
87763
|
+
void 0
|
87764
|
+
);
|
87765
|
+
}));
|
87766
|
+
continue;
|
87767
|
+
}
|
87768
|
+
}
|
87634
87769
|
const node = nodeBuilder.indexInfoToIndexSignatureDeclaration(info, enclosing, flags, internalFlags, tracker);
|
87635
87770
|
if (node && infoList === staticInfos) {
|
87636
87771
|
(node.modifiers || (node.modifiers = factory.createNodeArray())).unshift(factory.createModifier(126 /* StaticKeyword */));
|
@@ -87641,6 +87776,22 @@ function createTypeChecker(host) {
|
|
87641
87776
|
}
|
87642
87777
|
}
|
87643
87778
|
return result;
|
87779
|
+
function trackComputedName(accessExpression) {
|
87780
|
+
if (!tracker.trackSymbol) return;
|
87781
|
+
const firstIdentifier = getFirstIdentifier(accessExpression);
|
87782
|
+
const name = resolveName(
|
87783
|
+
firstIdentifier,
|
87784
|
+
firstIdentifier.escapedText,
|
87785
|
+
111551 /* Value */ | 1048576 /* ExportValue */,
|
87786
|
+
/*nameNotFoundMessage*/
|
87787
|
+
void 0,
|
87788
|
+
/*isUse*/
|
87789
|
+
true
|
87790
|
+
);
|
87791
|
+
if (name) {
|
87792
|
+
tracker.trackSymbol(name, enclosing, 111551 /* Value */);
|
87793
|
+
}
|
87794
|
+
}
|
87644
87795
|
}
|
87645
87796
|
};
|
87646
87797
|
function isImportRequiredByAugmentation(node) {
|
@@ -88885,7 +89036,7 @@ function createTypeChecker(host) {
|
|
88885
89036
|
}
|
88886
89037
|
}
|
88887
89038
|
function checkGrammarForInvalidDynamicName(node, message) {
|
88888
|
-
if (isNonBindableDynamicName(node)) {
|
89039
|
+
if (isNonBindableDynamicName(node) && !isEntityNameExpression(isElementAccessExpression(node) ? skipParentheses(node.argumentExpression) : node.expression)) {
|
88889
89040
|
return grammarErrorOnNode(node, message);
|
88890
89041
|
}
|
88891
89042
|
}
|
@@ -121267,11 +121418,13 @@ function createCreateProgramOptions(rootNames, options, host, oldProgram, config
|
|
121267
121418
|
typeScriptVersion: typeScriptVersion2
|
121268
121419
|
};
|
121269
121420
|
}
|
121270
|
-
function createProgram(
|
121421
|
+
function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
121271
121422
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
121272
|
-
|
121273
|
-
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion2 } =
|
121274
|
-
let { oldProgram } =
|
121423
|
+
let _createProgramOptions = isArray(_rootNamesOrOptions) ? createCreateProgramOptions(_rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : _rootNamesOrOptions;
|
121424
|
+
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion2, host: createProgramOptionsHost } = _createProgramOptions;
|
121425
|
+
let { oldProgram } = _createProgramOptions;
|
121426
|
+
_createProgramOptions = void 0;
|
121427
|
+
_rootNamesOrOptions = void 0;
|
121275
121428
|
for (const option of commandLineOptionOfCustomType) {
|
121276
121429
|
if (hasProperty(options, option.name)) {
|
121277
121430
|
if (typeof options[option.name] === "string") {
|
@@ -121311,7 +121464,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
121311
121464
|
true
|
121312
121465
|
);
|
121313
121466
|
mark("beforeProgram");
|
121314
|
-
const host =
|
121467
|
+
const host = createProgramOptionsHost || createCompilerHost(options);
|
121315
121468
|
const configParsingHost = parseConfigHostFromCompilerHostLike(host);
|
121316
121469
|
let skipDefaultLib = options.noLib;
|
121317
121470
|
const getDefaultLibraryFileName = memoize(() => host.getDefaultLibFileName(options));
|
@@ -123252,6 +123405,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
123252
123405
|
var _a2, _b2, _c2, _d2, _e2;
|
123253
123406
|
const existing = resolvedLibProcessing == null ? void 0 : resolvedLibProcessing.get(libFileName);
|
123254
123407
|
if (existing) return existing;
|
123408
|
+
if (options.libReplacement === false) {
|
123409
|
+
const result2 = {
|
123410
|
+
resolution: {
|
123411
|
+
resolvedModule: void 0
|
123412
|
+
},
|
123413
|
+
actual: combinePaths(defaultLibraryPath, libFileName)
|
123414
|
+
};
|
123415
|
+
(resolvedLibProcessing ?? (resolvedLibProcessing = /* @__PURE__ */ new Map())).set(libFileName, result2);
|
123416
|
+
return result2;
|
123417
|
+
}
|
123255
123418
|
if (structureIsReused !== 0 /* Not */ && oldProgram && !hasInvalidatedLibResolutions(libFileName)) {
|
123256
123419
|
const oldResolution = (_a2 = oldProgram.resolvedLibReferences) == null ? void 0 : _a2.get(libFileName);
|
123257
123420
|
if (oldResolution) {
|
package/lib/typescript.d.ts
CHANGED
@@ -6348,6 +6348,7 @@ declare namespace ts {
|
|
6348
6348
|
* and the operation is cancelled, then it should be discarded, otherwise it is safe to keep.
|
6349
6349
|
*/
|
6350
6350
|
runWithCancellationToken<T>(token: CancellationToken, cb: (checker: TypeChecker) => T): T;
|
6351
|
+
getTypeArgumentsForResolvedSignature(signature: Signature): readonly Type[] | undefined;
|
6351
6352
|
}
|
6352
6353
|
enum NodeBuilderFlags {
|
6353
6354
|
None = 0,
|
@@ -6851,11 +6852,15 @@ declare namespace ts {
|
|
6851
6852
|
String = 0,
|
6852
6853
|
Number = 1,
|
6853
6854
|
}
|
6855
|
+
type ElementWithComputedPropertyName = (ClassElement | ObjectLiteralElement) & {
|
6856
|
+
name: ComputedPropertyName;
|
6857
|
+
};
|
6854
6858
|
interface IndexInfo {
|
6855
6859
|
keyType: Type;
|
6856
6860
|
type: Type;
|
6857
6861
|
isReadonly: boolean;
|
6858
6862
|
declaration?: IndexSignatureDeclaration;
|
6863
|
+
components?: ElementWithComputedPropertyName[];
|
6859
6864
|
}
|
6860
6865
|
enum InferencePriority {
|
6861
6866
|
None = 0,
|
@@ -7026,6 +7031,7 @@ declare namespace ts {
|
|
7026
7031
|
/** @deprecated */
|
7027
7032
|
keyofStringsOnly?: boolean;
|
7028
7033
|
lib?: string[];
|
7034
|
+
libReplacement?: boolean;
|
7029
7035
|
locale?: string;
|
7030
7036
|
mapRoot?: string;
|
7031
7037
|
maxNodeModuleJsDepth?: number;
|
@@ -7102,6 +7108,7 @@ declare namespace ts {
|
|
7102
7108
|
/** Paths used to compute primary types search locations */
|
7103
7109
|
typeRoots?: string[];
|
7104
7110
|
verbatimModuleSyntax?: boolean;
|
7111
|
+
erasableSyntaxOnly?: boolean;
|
7105
7112
|
esModuleInterop?: boolean;
|
7106
7113
|
useDefineForClassFields?: boolean;
|
7107
7114
|
[option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined;
|
package/lib/typescript.js
CHANGED
@@ -2285,7 +2285,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
2285
2285
|
|
2286
2286
|
// src/compiler/corePublic.ts
|
2287
2287
|
var versionMajorMinor = "5.8";
|
2288
|
-
var version = `${versionMajorMinor}.0-dev.
|
2288
|
+
var version = `${versionMajorMinor}.0-dev.20250125`;
|
2289
2289
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
2290
2290
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
2291
2291
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
@@ -9407,6 +9407,7 @@ var Diagnostics = {
|
|
9407
9407
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1291, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1291", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
|
9408
9408
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1292, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1292", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
|
9409
9409
|
ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve: diag(1293, 1 /* Error */, "ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293", "ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'."),
|
9410
|
+
This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled: diag(1294, 1 /* Error */, "This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled_1294", "This syntax is not allowed when 'erasableSyntaxOnly' is enabled."),
|
9410
9411
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, 1 /* Error */, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
9411
9412
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, 1 /* Error */, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
9412
9413
|
The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, 1 /* Error */, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
|
@@ -10894,11 +10895,13 @@ var Diagnostics = {
|
|
10894
10895
|
Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
|
10895
10896
|
Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files: diag(6719, 3 /* Message */, "Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files_6719", "Require sufficient annotation on exports so other tools can trivially generate declaration files."),
|
10896
10897
|
Built_in_iterators_are_instantiated_with_a_TReturn_type_of_undefined_instead_of_any: diag(6720, 3 /* Message */, "Built_in_iterators_are_instantiated_with_a_TReturn_type_of_undefined_instead_of_any_6720", "Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'."),
|
10898
|
+
Do_not_allow_runtime_constructs_that_are_not_part_of_ECMAScript: diag(6721, 3 /* Message */, "Do_not_allow_runtime_constructs_that_are_not_part_of_ECMAScript_6721", "Do not allow runtime constructs that are not part of ECMAScript."),
|
10897
10899
|
Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
|
10898
10900
|
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
|
10899
10901
|
Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported: diag(6805, 3 /* Message */, "Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported_6805", "Disable full type checking (only critical parse and emit errors will be reported)."),
|
10900
10902
|
Check_side_effect_imports: diag(6806, 3 /* Message */, "Check_side_effect_imports_6806", "Check side effect imports."),
|
10901
10903
|
This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2: diag(6807, 1 /* Error */, "This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2_6807", "This operation can be simplified. This shift is identical to `{0} {1} {2}`."),
|
10904
|
+
Enable_lib_replacement: diag(6808, 3 /* Message */, "Enable_lib_replacement_6808", "Enable lib replacement."),
|
10902
10905
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
10903
10906
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
10904
10907
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
@@ -41107,6 +41110,23 @@ var commandOptionsWithoutBuild = [
|
|
41107
41110
|
affectsBuildInfo: true,
|
41108
41111
|
affectsSemanticDiagnostics: true
|
41109
41112
|
},
|
41113
|
+
{
|
41114
|
+
name: "erasableSyntaxOnly",
|
41115
|
+
type: "boolean",
|
41116
|
+
category: Diagnostics.Interop_Constraints,
|
41117
|
+
description: Diagnostics.Do_not_allow_runtime_constructs_that_are_not_part_of_ECMAScript,
|
41118
|
+
defaultValueDescription: false,
|
41119
|
+
affectsBuildInfo: true,
|
41120
|
+
affectsSemanticDiagnostics: true
|
41121
|
+
},
|
41122
|
+
{
|
41123
|
+
name: "libReplacement",
|
41124
|
+
type: "boolean",
|
41125
|
+
affectsProgramStructure: true,
|
41126
|
+
category: Diagnostics.Language_and_Environment,
|
41127
|
+
description: Diagnostics.Enable_lib_replacement,
|
41128
|
+
defaultValueDescription: true
|
41129
|
+
},
|
41110
41130
|
// Strict Type Checks
|
41111
41131
|
{
|
41112
41132
|
name: "strict",
|
@@ -45795,6 +45815,7 @@ function hasOneAsterisk(patternKey) {
|
|
45795
45815
|
function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
|
45796
45816
|
return loadModuleFromTargetExportOrImport;
|
45797
45817
|
function loadModuleFromTargetExportOrImport(target, subpath, pattern, key) {
|
45818
|
+
var _a, _b;
|
45798
45819
|
if (typeof target === "string") {
|
45799
45820
|
if (!pattern && subpath.length > 0 && !endsWith(target, "/")) {
|
45800
45821
|
if (state.traceEnabled) {
|
@@ -45823,6 +45844,8 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
|
|
45823
45844
|
redirectedReference,
|
45824
45845
|
state.conditions
|
45825
45846
|
);
|
45847
|
+
(_a = state.failedLookupLocations) == null ? void 0 : _a.push(...result.failedLookupLocations ?? emptyArray);
|
45848
|
+
(_b = state.affectingLocations) == null ? void 0 : _b.push(...result.affectingLocations ?? emptyArray);
|
45826
45849
|
return toSearchResult(
|
45827
45850
|
result.resolvedModule ? {
|
45828
45851
|
path: result.resolvedModule.resolvedFileName,
|
@@ -45932,20 +45955,20 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
|
|
45932
45955
|
void 0
|
45933
45956
|
);
|
45934
45957
|
function toAbsolutePath(path) {
|
45935
|
-
var
|
45958
|
+
var _a2, _b2;
|
45936
45959
|
if (path === void 0) return path;
|
45937
|
-
return getNormalizedAbsolutePath(path, (
|
45960
|
+
return getNormalizedAbsolutePath(path, (_b2 = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b2.call(_a2));
|
45938
45961
|
}
|
45939
45962
|
function combineDirectoryPath(root, dir) {
|
45940
45963
|
return ensureTrailingDirectorySeparator(combinePaths(root, dir));
|
45941
45964
|
}
|
45942
45965
|
function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports2) {
|
45943
|
-
var
|
45966
|
+
var _a2, _b2, _c, _d;
|
45944
45967
|
if (!state.isConfigLookup && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && !finalPath.includes("/node_modules/") && (state.compilerOptions.configFile ? containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames(state)) : true)) {
|
45945
45968
|
const getCanonicalFileName = hostGetCanonicalFileName({ useCaseSensitiveFileNames: () => useCaseSensitiveFileNames(state) });
|
45946
45969
|
const commonSourceDirGuesses = [];
|
45947
45970
|
if (state.compilerOptions.rootDir || state.compilerOptions.composite && state.compilerOptions.configFilePath) {
|
45948
|
-
const commonDir = toAbsolutePath(getCommonSourceDirectory(state.compilerOptions, () => [], ((
|
45971
|
+
const commonDir = toAbsolutePath(getCommonSourceDirectory(state.compilerOptions, () => [], ((_b2 = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b2.call(_a2)) || "", getCanonicalFileName));
|
45949
45972
|
commonSourceDirGuesses.push(commonDir);
|
45950
45973
|
} else if (state.requestContainingDirectory) {
|
45951
45974
|
const requestingFile = toAbsolutePath(combinePaths(state.requestContainingDirectory, "index.ts"));
|
@@ -46001,8 +46024,8 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
|
|
46001
46024
|
}
|
46002
46025
|
return void 0;
|
46003
46026
|
function getOutputDirectoriesForBaseDirectory(commonSourceDirGuess) {
|
46004
|
-
var
|
46005
|
-
const currentDir = state.compilerOptions.configFile ? ((
|
46027
|
+
var _a3, _b3;
|
46028
|
+
const currentDir = state.compilerOptions.configFile ? ((_b3 = (_a3 = state.host).getCurrentDirectory) == null ? void 0 : _b3.call(_a3)) || "" : commonSourceDirGuess;
|
46006
46029
|
const candidateDirectories = [];
|
46007
46030
|
if (state.compilerOptions.declarationDir) {
|
46008
46031
|
candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.declarationDir)));
|
@@ -51198,8 +51221,13 @@ function createTypeChecker(host) {
|
|
51198
51221
|
getMemberOverrideModifierStatus,
|
51199
51222
|
isTypeParameterPossiblyReferenced,
|
51200
51223
|
typeHasCallOrConstructSignatures,
|
51201
|
-
getSymbolFlags
|
51224
|
+
getSymbolFlags,
|
51225
|
+
getTypeArgumentsForResolvedSignature
|
51202
51226
|
};
|
51227
|
+
function getTypeArgumentsForResolvedSignature(signature) {
|
51228
|
+
if (signature.mapper === void 0) return void 0;
|
51229
|
+
return instantiateTypes((signature.target || signature).typeParameters, signature.mapper);
|
51230
|
+
}
|
51203
51231
|
function getCandidateSignaturesForStringLiteralCompletions(call, editingArgument) {
|
51204
51232
|
const candidatesSet = /* @__PURE__ */ new Set();
|
51205
51233
|
const candidates = [];
|
@@ -55839,7 +55867,7 @@ function createTypeChecker(host) {
|
|
55839
55867
|
function shouldWriteTypeOfFunctionSymbol() {
|
55840
55868
|
var _a3;
|
55841
55869
|
const isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */) && // typeof static method
|
55842
|
-
some(symbol.declarations, (declaration) => isStatic(declaration));
|
55870
|
+
some(symbol.declarations, (declaration) => isStatic(declaration) && !isLateBindableIndexSignature(getNameOfDeclaration(declaration)));
|
55843
55871
|
const isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol
|
55844
55872
|
forEach(symbol.declarations, (declaration) => declaration.parent.kind === 307 /* SourceFile */ || declaration.parent.kind === 268 /* ModuleBlock */));
|
55845
55873
|
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
|
@@ -56142,6 +56170,38 @@ function createTypeChecker(host) {
|
|
56142
56170
|
ids.unshift(state);
|
56143
56171
|
return ids;
|
56144
56172
|
}
|
56173
|
+
function indexInfoToObjectComputedNamesOrSignatureDeclaration(indexInfo, context2, typeNode) {
|
56174
|
+
if (indexInfo.components) {
|
56175
|
+
const allComponentComputedNamesSerializable = every(indexInfo.components, (e) => {
|
56176
|
+
var _a2;
|
56177
|
+
return !!(e.name && isComputedPropertyName(e.name) && isEntityNameExpression(e.name.expression) && context2.enclosingDeclaration && ((_a2 = isEntityNameVisible(
|
56178
|
+
e.name.expression,
|
56179
|
+
context2.enclosingDeclaration,
|
56180
|
+
/*shouldComputeAliasToMakeVisible*/
|
56181
|
+
false
|
56182
|
+
)) == null ? void 0 : _a2.accessibility) === 0 /* Accessible */);
|
56183
|
+
});
|
56184
|
+
if (allComponentComputedNamesSerializable) {
|
56185
|
+
const newComponents = filter(indexInfo.components, (e) => {
|
56186
|
+
return !hasLateBindableName(e);
|
56187
|
+
});
|
56188
|
+
return map(newComponents, (e) => {
|
56189
|
+
trackComputedName(e.name.expression, context2.enclosingDeclaration, context2);
|
56190
|
+
return setTextRange2(
|
56191
|
+
context2,
|
56192
|
+
factory.createPropertySignature(
|
56193
|
+
indexInfo.isReadonly ? [factory.createModifier(148 /* ReadonlyKeyword */)] : void 0,
|
56194
|
+
e.name,
|
56195
|
+
(isPropertySignature(e) || isPropertyDeclaration(e) || isMethodSignature(e) || isMethodDeclaration(e) || isGetAccessor(e) || isSetAccessor(e)) && e.questionToken ? factory.createToken(58 /* QuestionToken */) : void 0,
|
56196
|
+
typeNode || typeToTypeNodeHelper(getTypeOfSymbol(e.symbol), context2)
|
56197
|
+
),
|
56198
|
+
e
|
56199
|
+
);
|
56200
|
+
});
|
56201
|
+
}
|
56202
|
+
}
|
56203
|
+
return [indexInfoToIndexSignatureDeclarationHelper(indexInfo, context2, typeNode)];
|
56204
|
+
}
|
56145
56205
|
function createTypeNodesFromResolvedType(resolvedType) {
|
56146
56206
|
if (checkTruncationLength(context)) {
|
56147
56207
|
if (context.flags & 1 /* NoTruncation */) {
|
@@ -56166,7 +56226,7 @@ function createTypeChecker(host) {
|
|
56166
56226
|
typeElements.push(signatureToSignatureDeclarationHelper(signature, 180 /* ConstructSignature */, context));
|
56167
56227
|
}
|
56168
56228
|
for (const info of resolvedType.indexInfos) {
|
56169
|
-
typeElements.push(
|
56229
|
+
typeElements.push(...indexInfoToObjectComputedNamesOrSignatureDeclaration(info, context, resolvedType.objectFlags & 1024 /* ReverseMapped */ ? createElidedInformationPlaceholder(context) : void 0));
|
56170
56230
|
}
|
56171
56231
|
const properties = resolvedType.properties;
|
56172
56232
|
if (!properties) {
|
@@ -56855,7 +56915,7 @@ function createTypeChecker(host) {
|
|
56855
56915
|
if (!context.tracker.canTrackSymbol) return;
|
56856
56916
|
const firstIdentifier = getFirstIdentifier(accessExpression);
|
56857
56917
|
const name = resolveName(
|
56858
|
-
|
56918
|
+
enclosingDeclaration,
|
56859
56919
|
firstIdentifier.escapedText,
|
56860
56920
|
111551 /* Value */ | 1048576 /* ExportValue */,
|
56861
56921
|
/*nameNotFoundMessage*/
|
@@ -56865,6 +56925,19 @@ function createTypeChecker(host) {
|
|
56865
56925
|
);
|
56866
56926
|
if (name) {
|
56867
56927
|
context.tracker.trackSymbol(name, enclosingDeclaration, 111551 /* Value */);
|
56928
|
+
} else {
|
56929
|
+
const fallback = resolveName(
|
56930
|
+
firstIdentifier,
|
56931
|
+
firstIdentifier.escapedText,
|
56932
|
+
111551 /* Value */ | 1048576 /* ExportValue */,
|
56933
|
+
/*nameNotFoundMessage*/
|
56934
|
+
void 0,
|
56935
|
+
/*isUse*/
|
56936
|
+
true
|
56937
|
+
);
|
56938
|
+
if (fallback) {
|
56939
|
+
context.tracker.trackSymbol(fallback, enclosingDeclaration, 111551 /* Value */);
|
56940
|
+
}
|
56868
56941
|
}
|
56869
56942
|
}
|
56870
56943
|
function lookupSymbolChain(symbol, context, meaning, yieldModuleSymbol) {
|
@@ -63679,8 +63752,8 @@ function createTypeChecker(host) {
|
|
63679
63752
|
function getIndexSymbolFromSymbolTable(symbolTable) {
|
63680
63753
|
return symbolTable.get("__index" /* Index */);
|
63681
63754
|
}
|
63682
|
-
function createIndexInfo(keyType, type, isReadonly, declaration) {
|
63683
|
-
return { keyType, type, isReadonly, declaration };
|
63755
|
+
function createIndexInfo(keyType, type, isReadonly, declaration, components) {
|
63756
|
+
return { keyType, type, isReadonly, declaration, components };
|
63684
63757
|
}
|
63685
63758
|
function getIndexInfosOfSymbol(symbol) {
|
63686
63759
|
const indexSymbol = getIndexSymbol(symbol);
|
@@ -66756,7 +66829,7 @@ function createTypeChecker(host) {
|
|
66756
66829
|
return result;
|
66757
66830
|
}
|
66758
66831
|
function getIndexInfoWithReadonly(info, readonly) {
|
66759
|
-
return info.isReadonly !== readonly ? createIndexInfo(info.keyType, info.type, readonly, info.declaration) : info;
|
66832
|
+
return info.isReadonly !== readonly ? createIndexInfo(info.keyType, info.type, readonly, info.declaration, info.components) : info;
|
66760
66833
|
}
|
66761
66834
|
function createLiteralType(flags, value, symbol, regularType) {
|
66762
66835
|
const type = createTypeWithSymbol(flags, symbol);
|
@@ -67546,7 +67619,7 @@ function createTypeChecker(host) {
|
|
67546
67619
|
return type.restrictiveInstantiation;
|
67547
67620
|
}
|
67548
67621
|
function instantiateIndexInfo(info, mapper) {
|
67549
|
-
return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration);
|
67622
|
+
return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration, info.components);
|
67550
67623
|
}
|
67551
67624
|
function isContextSensitive(node) {
|
67552
67625
|
Debug.assert(node.kind !== 174 /* MethodDeclaration */ || isObjectLiteralMethod(node));
|
@@ -71679,7 +71752,7 @@ function createTypeChecker(host) {
|
|
71679
71752
|
}
|
71680
71753
|
}
|
71681
71754
|
}
|
71682
|
-
const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, sameMap(getIndexInfosOfType(type), (info) => createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly)));
|
71755
|
+
const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, sameMap(getIndexInfosOfType(type), (info) => createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly, info.declaration, info.components)));
|
71683
71756
|
result.objectFlags |= getObjectFlags(type) & (4096 /* JSLiteral */ | 262144 /* NonInferrableType */);
|
71684
71757
|
return result;
|
71685
71758
|
}
|
@@ -77729,16 +77802,33 @@ function createTypeChecker(host) {
|
|
77729
77802
|
const firstDecl = (_a = symbol.declarations) == null ? void 0 : _a[0];
|
77730
77803
|
return isKnownSymbol(symbol) || firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 4096 /* ESSymbol */);
|
77731
77804
|
}
|
77805
|
+
function isSymbolWithComputedName(symbol) {
|
77806
|
+
var _a;
|
77807
|
+
const firstDecl = (_a = symbol.declarations) == null ? void 0 : _a[0];
|
77808
|
+
return firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name);
|
77809
|
+
}
|
77732
77810
|
function getObjectLiteralIndexInfo(isReadonly, offset, properties, keyType) {
|
77811
|
+
var _a;
|
77733
77812
|
const propTypes = [];
|
77813
|
+
let components;
|
77734
77814
|
for (let i = offset; i < properties.length; i++) {
|
77735
77815
|
const prop = properties[i];
|
77736
77816
|
if (keyType === stringType && !isSymbolWithSymbolName(prop) || keyType === numberType && isSymbolWithNumericName(prop) || keyType === esSymbolType && isSymbolWithSymbolName(prop)) {
|
77737
77817
|
propTypes.push(getTypeOfSymbol(properties[i]));
|
77818
|
+
if (isSymbolWithComputedName(properties[i])) {
|
77819
|
+
components = append(components, (_a = properties[i].declarations) == null ? void 0 : _a[0]);
|
77820
|
+
}
|
77738
77821
|
}
|
77739
77822
|
}
|
77740
77823
|
const unionType = propTypes.length ? getUnionType(propTypes, 2 /* Subtype */) : undefinedType;
|
77741
|
-
return createIndexInfo(
|
77824
|
+
return createIndexInfo(
|
77825
|
+
keyType,
|
77826
|
+
unionType,
|
77827
|
+
isReadonly,
|
77828
|
+
/*declaration*/
|
77829
|
+
void 0,
|
77830
|
+
components
|
77831
|
+
);
|
77742
77832
|
}
|
77743
77833
|
function getImmediateAliasedSymbol(symbol) {
|
77744
77834
|
Debug.assert((symbol.flags & 2097152 /* Alias */) !== 0, "Should only get Alias here.");
|
@@ -78273,6 +78363,9 @@ function createTypeChecker(host) {
|
|
78273
78363
|
return getNameFromJsxElementAttributesContainer(JsxNames.ElementAttributesPropertyNameContainer, jsxNamespace);
|
78274
78364
|
}
|
78275
78365
|
function getJsxElementChildrenPropertyName(jsxNamespace) {
|
78366
|
+
if (compilerOptions.jsx === 4 /* ReactJSX */ || compilerOptions.jsx === 5 /* ReactJSXDev */) {
|
78367
|
+
return "children";
|
78368
|
+
}
|
78276
78369
|
return getNameFromJsxElementAttributesContainer(JsxNames.ElementChildrenAttributeNameContainer, jsxNamespace);
|
78277
78370
|
}
|
78278
78371
|
function getUninstantiatedJsxSignaturesOfType(elementType, caller) {
|
@@ -84784,6 +84877,9 @@ function createTypeChecker(host) {
|
|
84784
84877
|
checkVariableLikeDeclaration(node);
|
84785
84878
|
const func = getContainingFunction(node);
|
84786
84879
|
if (hasSyntacticModifier(node, 31 /* ParameterPropertyModifier */)) {
|
84880
|
+
if (compilerOptions.erasableSyntaxOnly) {
|
84881
|
+
error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
84882
|
+
}
|
84787
84883
|
if (!(func.kind === 176 /* Constructor */ && nodeIsPresent(func.body))) {
|
84788
84884
|
error2(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
|
84789
84885
|
}
|
@@ -88438,7 +88534,7 @@ function createTypeChecker(host) {
|
|
88438
88534
|
const typeDeclaration = symbol.valueDeclaration;
|
88439
88535
|
if (typeDeclaration && isClassLike(typeDeclaration)) {
|
88440
88536
|
for (const member of typeDeclaration.members) {
|
88441
|
-
if (!isStatic(member) && !hasBindableName(member)) {
|
88537
|
+
if ((!isStaticIndex && !isStatic(member) || isStaticIndex && isStatic(member)) && !hasBindableName(member)) {
|
88442
88538
|
const symbol2 = getSymbolOfDeclaration(member);
|
88443
88539
|
checkIndexConstraintForProperty(type, symbol2, getTypeOfExpression(member.name.expression), getNonMissingTypeOfSymbol(symbol2));
|
88444
88540
|
}
|
@@ -89488,6 +89584,9 @@ function createTypeChecker(host) {
|
|
89488
89584
|
checkCollisionsForDeclarationName(node, node.name);
|
89489
89585
|
checkExportsOnMergedDeclarations(node);
|
89490
89586
|
node.members.forEach(checkEnumMember);
|
89587
|
+
if (compilerOptions.erasableSyntaxOnly && !(node.flags & 33554432 /* Ambient */)) {
|
89588
|
+
error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
89589
|
+
}
|
89491
89590
|
computeEnumMemberValues(node);
|
89492
89591
|
const enumSymbol = getSymbolOfDeclaration(node);
|
89493
89592
|
const firstDeclaration = getDeclarationOfKind(enumSymbol, node.kind);
|
@@ -89589,6 +89688,9 @@ function createTypeChecker(host) {
|
|
89589
89688
|
checkExportsOnMergedDeclarations(node);
|
89590
89689
|
const symbol = getSymbolOfDeclaration(node);
|
89591
89690
|
if (symbol.flags & 512 /* ValueModule */ && !inAmbientContext && isInstantiatedModule(node, shouldPreserveConstEnums(compilerOptions))) {
|
89691
|
+
if (compilerOptions.erasableSyntaxOnly) {
|
89692
|
+
error2(node.name, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
89693
|
+
}
|
89592
89694
|
if (getIsolatedModules(compilerOptions) && !getSourceFileOfNode(node).externalModuleIndicator) {
|
89593
89695
|
error2(node.name, Diagnostics.Namespaces_are_not_allowed_in_global_script_files_when_0_is_enabled_If_this_file_is_not_intended_to_be_a_global_script_set_moduleDetection_to_force_or_add_an_empty_export_statement, isolatedModulesLikeFlagName);
|
89594
89696
|
}
|
@@ -89976,7 +90078,11 @@ function createTypeChecker(host) {
|
|
89976
90078
|
return;
|
89977
90079
|
}
|
89978
90080
|
checkGrammarModifiers(node);
|
89979
|
-
|
90081
|
+
const isImportEquals = isInternalModuleImportEqualsDeclaration(node);
|
90082
|
+
if (compilerOptions.erasableSyntaxOnly && isImportEquals && !(node.flags & 33554432 /* Ambient */)) {
|
90083
|
+
error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
90084
|
+
}
|
90085
|
+
if (isImportEquals || checkExternalImportOrExportDeclaration(node)) {
|
89980
90086
|
checkImportBinding(node);
|
89981
90087
|
markLinkedReferences(node, 6 /* ExportImportEquals */);
|
89982
90088
|
if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
|
@@ -92241,6 +92347,35 @@ function createTypeChecker(host) {
|
|
92241
92347
|
for (const info of infoList) {
|
92242
92348
|
if (info.declaration) continue;
|
92243
92349
|
if (info === anyBaseTypeIndexInfo) continue;
|
92350
|
+
if (info.components) {
|
92351
|
+
const allComponentComputedNamesSerializable = every(info.components, (e) => {
|
92352
|
+
var _a;
|
92353
|
+
return !!(e.name && isComputedPropertyName(e.name) && isEntityNameExpression(e.name.expression) && enclosing && ((_a = isEntityNameVisible(
|
92354
|
+
e.name.expression,
|
92355
|
+
enclosing,
|
92356
|
+
/*shouldComputeAliasToMakeVisible*/
|
92357
|
+
false
|
92358
|
+
)) == null ? void 0 : _a.accessibility) === 0 /* Accessible */);
|
92359
|
+
});
|
92360
|
+
if (allComponentComputedNamesSerializable) {
|
92361
|
+
const newComponents = filter(info.components, (e) => {
|
92362
|
+
return !hasLateBindableName(e);
|
92363
|
+
});
|
92364
|
+
result.push(...map(newComponents, (e) => {
|
92365
|
+
trackComputedName(e.name.expression);
|
92366
|
+
const mods = infoList === staticInfos ? [factory.createModifier(126 /* StaticKeyword */)] : void 0;
|
92367
|
+
return factory.createPropertyDeclaration(
|
92368
|
+
append(mods, info.isReadonly ? factory.createModifier(148 /* ReadonlyKeyword */) : void 0),
|
92369
|
+
e.name,
|
92370
|
+
(isPropertySignature(e) || isPropertyDeclaration(e) || isMethodSignature(e) || isMethodDeclaration(e) || isGetAccessor(e) || isSetAccessor(e)) && e.questionToken ? factory.createToken(58 /* QuestionToken */) : void 0,
|
92371
|
+
nodeBuilder.typeToTypeNode(getTypeOfSymbol(e.symbol), enclosing, flags, internalFlags, tracker),
|
92372
|
+
/*initializer*/
|
92373
|
+
void 0
|
92374
|
+
);
|
92375
|
+
}));
|
92376
|
+
continue;
|
92377
|
+
}
|
92378
|
+
}
|
92244
92379
|
const node = nodeBuilder.indexInfoToIndexSignatureDeclaration(info, enclosing, flags, internalFlags, tracker);
|
92245
92380
|
if (node && infoList === staticInfos) {
|
92246
92381
|
(node.modifiers || (node.modifiers = factory.createNodeArray())).unshift(factory.createModifier(126 /* StaticKeyword */));
|
@@ -92251,6 +92386,22 @@ function createTypeChecker(host) {
|
|
92251
92386
|
}
|
92252
92387
|
}
|
92253
92388
|
return result;
|
92389
|
+
function trackComputedName(accessExpression) {
|
92390
|
+
if (!tracker.trackSymbol) return;
|
92391
|
+
const firstIdentifier = getFirstIdentifier(accessExpression);
|
92392
|
+
const name = resolveName(
|
92393
|
+
firstIdentifier,
|
92394
|
+
firstIdentifier.escapedText,
|
92395
|
+
111551 /* Value */ | 1048576 /* ExportValue */,
|
92396
|
+
/*nameNotFoundMessage*/
|
92397
|
+
void 0,
|
92398
|
+
/*isUse*/
|
92399
|
+
true
|
92400
|
+
);
|
92401
|
+
if (name) {
|
92402
|
+
tracker.trackSymbol(name, enclosing, 111551 /* Value */);
|
92403
|
+
}
|
92404
|
+
}
|
92254
92405
|
}
|
92255
92406
|
};
|
92256
92407
|
function isImportRequiredByAugmentation(node) {
|
@@ -93495,7 +93646,7 @@ function createTypeChecker(host) {
|
|
93495
93646
|
}
|
93496
93647
|
}
|
93497
93648
|
function checkGrammarForInvalidDynamicName(node, message) {
|
93498
|
-
if (isNonBindableDynamicName(node)) {
|
93649
|
+
if (isNonBindableDynamicName(node) && !isEntityNameExpression(isElementAccessExpression(node) ? skipParentheses(node.argumentExpression) : node.expression)) {
|
93499
93650
|
return grammarErrorOnNode(node, message);
|
93500
93651
|
}
|
93501
93652
|
}
|
@@ -126116,11 +126267,13 @@ function createCreateProgramOptions(rootNames, options, host, oldProgram, config
|
|
126116
126267
|
typeScriptVersion: typeScriptVersion3
|
126117
126268
|
};
|
126118
126269
|
}
|
126119
|
-
function createProgram(
|
126270
|
+
function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
126120
126271
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
126121
|
-
|
126122
|
-
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3 } =
|
126123
|
-
let { oldProgram } =
|
126272
|
+
let _createProgramOptions = isArray(_rootNamesOrOptions) ? createCreateProgramOptions(_rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : _rootNamesOrOptions;
|
126273
|
+
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3, host: createProgramOptionsHost } = _createProgramOptions;
|
126274
|
+
let { oldProgram } = _createProgramOptions;
|
126275
|
+
_createProgramOptions = void 0;
|
126276
|
+
_rootNamesOrOptions = void 0;
|
126124
126277
|
for (const option of commandLineOptionOfCustomType) {
|
126125
126278
|
if (hasProperty(options, option.name)) {
|
126126
126279
|
if (typeof options[option.name] === "string") {
|
@@ -126160,7 +126313,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
126160
126313
|
true
|
126161
126314
|
);
|
126162
126315
|
mark("beforeProgram");
|
126163
|
-
const host =
|
126316
|
+
const host = createProgramOptionsHost || createCompilerHost(options);
|
126164
126317
|
const configParsingHost = parseConfigHostFromCompilerHostLike(host);
|
126165
126318
|
let skipDefaultLib = options.noLib;
|
126166
126319
|
const getDefaultLibraryFileName = memoize(() => host.getDefaultLibFileName(options));
|
@@ -128101,6 +128254,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128101
128254
|
var _a2, _b2, _c2, _d2, _e2;
|
128102
128255
|
const existing = resolvedLibProcessing == null ? void 0 : resolvedLibProcessing.get(libFileName);
|
128103
128256
|
if (existing) return existing;
|
128257
|
+
if (options.libReplacement === false) {
|
128258
|
+
const result2 = {
|
128259
|
+
resolution: {
|
128260
|
+
resolvedModule: void 0
|
128261
|
+
},
|
128262
|
+
actual: combinePaths(defaultLibraryPath, libFileName)
|
128263
|
+
};
|
128264
|
+
(resolvedLibProcessing ?? (resolvedLibProcessing = /* @__PURE__ */ new Map())).set(libFileName, result2);
|
128265
|
+
return result2;
|
128266
|
+
}
|
128104
128267
|
if (structureIsReused !== 0 /* Not */ && oldProgram && !hasInvalidatedLibResolutions(libFileName)) {
|
128105
128268
|
const oldResolution = (_a2 = oldProgram.resolvedLibReferences) == null ? void 0 : _a2.get(libFileName);
|
128106
128269
|
if (oldResolution) {
|
@@ -173588,7 +173751,10 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
|
|
173588
173751
|
const { parent: parent2 } = node;
|
173589
173752
|
const typeChecker = program.getTypeChecker();
|
173590
173753
|
if (node.kind === 164 /* OverrideKeyword */ || isIdentifier(node) && isJSDocOverrideTag(parent2) && parent2.tagName === node) {
|
173591
|
-
|
173754
|
+
const def = getDefinitionFromOverriddenMember(typeChecker, node);
|
173755
|
+
if (def !== void 0 || node.kind !== 164 /* OverrideKeyword */) {
|
173756
|
+
return def || emptyArray;
|
173757
|
+
}
|
173592
173758
|
}
|
173593
173759
|
if (isJumpStatementTarget(node)) {
|
173594
173760
|
const label = getTargetLabel(node.parent, node.text);
|
@@ -173602,9 +173768,6 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
|
|
173602
173768
|
)] : void 0;
|
173603
173769
|
}
|
173604
173770
|
switch (node.kind) {
|
173605
|
-
case 107 /* ReturnKeyword */:
|
173606
|
-
const functionDeclaration = findAncestor(node.parent, (n) => isClassStaticBlockDeclaration(n) ? "quit" : isFunctionLikeDeclaration(n));
|
173607
|
-
return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
|
173608
173771
|
case 90 /* DefaultKeyword */:
|
173609
173772
|
if (!isDefaultClause(node.parent)) {
|
173610
173773
|
break;
|
@@ -173617,15 +173780,14 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
|
|
173617
173780
|
}
|
173618
173781
|
break;
|
173619
173782
|
}
|
173620
|
-
|
173621
|
-
|
173622
|
-
|
173623
|
-
|
173624
|
-
|
173625
|
-
|
173626
|
-
|
173627
|
-
|
173628
|
-
return isGeneratorFunction ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
|
173783
|
+
let findFunctionDecl;
|
173784
|
+
switch (node.kind) {
|
173785
|
+
case 107 /* ReturnKeyword */:
|
173786
|
+
case 135 /* AwaitKeyword */:
|
173787
|
+
case 127 /* YieldKeyword */:
|
173788
|
+
findFunctionDecl = isFunctionLikeDeclaration;
|
173789
|
+
const functionDeclaration = findAncestor(node, findFunctionDecl);
|
173790
|
+
return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
|
173629
173791
|
}
|
173630
173792
|
if (isStaticModifier(node) && isClassStaticBlockDeclaration(node.parent)) {
|
173631
173793
|
const classDecl = node.parent.parent;
|
@@ -173675,6 +173837,9 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
|
|
173675
173837
|
}];
|
173676
173838
|
}
|
173677
173839
|
}
|
173840
|
+
if (isModifier(node) && (isClassElement(parent2) || isNamedDeclaration(parent2))) {
|
173841
|
+
symbol = parent2.symbol;
|
173842
|
+
}
|
173678
173843
|
if (!symbol) {
|
173679
173844
|
return concatenate(fileReferenceDefinition, getDefinitionInfoForIndexSignatures(node, typeChecker));
|
173680
173845
|
}
|
@@ -173871,12 +174036,16 @@ function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) {
|
|
173871
174036
|
false
|
173872
174037
|
);
|
173873
174038
|
}
|
173874
|
-
|
174039
|
+
let { symbol, failedAliasResolution } = getSymbol(
|
173875
174040
|
node,
|
173876
174041
|
typeChecker,
|
173877
174042
|
/*stopAtAlias*/
|
173878
174043
|
false
|
173879
174044
|
);
|
174045
|
+
if (isModifier(node) && (isClassElement(node.parent) || isNamedDeclaration(node.parent))) {
|
174046
|
+
symbol = node.parent.symbol;
|
174047
|
+
failedAliasResolution = false;
|
174048
|
+
}
|
173880
174049
|
if (!symbol) return void 0;
|
173881
174050
|
const typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
173882
174051
|
const returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
|
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.8.0-dev.
|
5
|
+
"version": "5.8.0-dev.20250125",
|
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": "caf1aee269d1660b4d2a8b555c2d602c97cb28d7"
|
120
120
|
}
|