typescript 5.8.0-dev.20250124 → 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 +119 -12
- package/lib/typescript.d.ts +4 -0
- package/lib/typescript.js +119 -12
- 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 = [];
|
@@ -51257,7 +51257,7 @@ function createTypeChecker(host) {
|
|
51257
51257
|
function shouldWriteTypeOfFunctionSymbol() {
|
51258
51258
|
var _a3;
|
51259
51259
|
const isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */) && // typeof static method
|
51260
|
-
some(symbol.declarations, (declaration) => isStatic(declaration));
|
51260
|
+
some(symbol.declarations, (declaration) => isStatic(declaration) && !isLateBindableIndexSignature(getNameOfDeclaration(declaration)));
|
51261
51261
|
const isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol
|
51262
51262
|
forEach(symbol.declarations, (declaration) => declaration.parent.kind === 307 /* SourceFile */ || declaration.parent.kind === 268 /* ModuleBlock */));
|
51263
51263
|
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
|
@@ -51560,6 +51560,38 @@ function createTypeChecker(host) {
|
|
51560
51560
|
ids.unshift(state);
|
51561
51561
|
return ids;
|
51562
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
|
+
}
|
51563
51595
|
function createTypeNodesFromResolvedType(resolvedType) {
|
51564
51596
|
if (checkTruncationLength(context)) {
|
51565
51597
|
if (context.flags & 1 /* NoTruncation */) {
|
@@ -51584,7 +51616,7 @@ function createTypeChecker(host) {
|
|
51584
51616
|
typeElements.push(signatureToSignatureDeclarationHelper(signature, 180 /* ConstructSignature */, context));
|
51585
51617
|
}
|
51586
51618
|
for (const info of resolvedType.indexInfos) {
|
51587
|
-
typeElements.push(
|
51619
|
+
typeElements.push(...indexInfoToObjectComputedNamesOrSignatureDeclaration(info, context, resolvedType.objectFlags & 1024 /* ReverseMapped */ ? createElidedInformationPlaceholder(context) : void 0));
|
51588
51620
|
}
|
51589
51621
|
const properties = resolvedType.properties;
|
51590
51622
|
if (!properties) {
|
@@ -52273,7 +52305,7 @@ function createTypeChecker(host) {
|
|
52273
52305
|
if (!context.tracker.canTrackSymbol) return;
|
52274
52306
|
const firstIdentifier = getFirstIdentifier(accessExpression);
|
52275
52307
|
const name = resolveName(
|
52276
|
-
|
52308
|
+
enclosingDeclaration,
|
52277
52309
|
firstIdentifier.escapedText,
|
52278
52310
|
111551 /* Value */ | 1048576 /* ExportValue */,
|
52279
52311
|
/*nameNotFoundMessage*/
|
@@ -52283,6 +52315,19 @@ function createTypeChecker(host) {
|
|
52283
52315
|
);
|
52284
52316
|
if (name) {
|
52285
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
|
+
}
|
52286
52331
|
}
|
52287
52332
|
}
|
52288
52333
|
function lookupSymbolChain(symbol, context, meaning, yieldModuleSymbol) {
|
@@ -59097,8 +59142,8 @@ function createTypeChecker(host) {
|
|
59097
59142
|
function getIndexSymbolFromSymbolTable(symbolTable) {
|
59098
59143
|
return symbolTable.get("__index" /* Index */);
|
59099
59144
|
}
|
59100
|
-
function createIndexInfo(keyType, type, isReadonly, declaration) {
|
59101
|
-
return { keyType, type, isReadonly, declaration };
|
59145
|
+
function createIndexInfo(keyType, type, isReadonly, declaration, components) {
|
59146
|
+
return { keyType, type, isReadonly, declaration, components };
|
59102
59147
|
}
|
59103
59148
|
function getIndexInfosOfSymbol(symbol) {
|
59104
59149
|
const indexSymbol = getIndexSymbol(symbol);
|
@@ -62174,7 +62219,7 @@ function createTypeChecker(host) {
|
|
62174
62219
|
return result;
|
62175
62220
|
}
|
62176
62221
|
function getIndexInfoWithReadonly(info, readonly) {
|
62177
|
-
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;
|
62178
62223
|
}
|
62179
62224
|
function createLiteralType(flags, value, symbol, regularType) {
|
62180
62225
|
const type = createTypeWithSymbol(flags, symbol);
|
@@ -62964,7 +63009,7 @@ function createTypeChecker(host) {
|
|
62964
63009
|
return type.restrictiveInstantiation;
|
62965
63010
|
}
|
62966
63011
|
function instantiateIndexInfo(info, mapper) {
|
62967
|
-
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);
|
62968
63013
|
}
|
62969
63014
|
function isContextSensitive(node) {
|
62970
63015
|
Debug.assert(node.kind !== 174 /* MethodDeclaration */ || isObjectLiteralMethod(node));
|
@@ -67097,7 +67142,7 @@ function createTypeChecker(host) {
|
|
67097
67142
|
}
|
67098
67143
|
}
|
67099
67144
|
}
|
67100
|
-
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)));
|
67101
67146
|
result.objectFlags |= getObjectFlags(type) & (4096 /* JSLiteral */ | 262144 /* NonInferrableType */);
|
67102
67147
|
return result;
|
67103
67148
|
}
|
@@ -73147,16 +73192,33 @@ function createTypeChecker(host) {
|
|
73147
73192
|
const firstDecl = (_a = symbol.declarations) == null ? void 0 : _a[0];
|
73148
73193
|
return isKnownSymbol(symbol) || firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 4096 /* ESSymbol */);
|
73149
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
|
+
}
|
73150
73200
|
function getObjectLiteralIndexInfo(isReadonly, offset, properties, keyType) {
|
73201
|
+
var _a;
|
73151
73202
|
const propTypes = [];
|
73203
|
+
let components;
|
73152
73204
|
for (let i = offset; i < properties.length; i++) {
|
73153
73205
|
const prop = properties[i];
|
73154
73206
|
if (keyType === stringType && !isSymbolWithSymbolName(prop) || keyType === numberType && isSymbolWithNumericName(prop) || keyType === esSymbolType && isSymbolWithSymbolName(prop)) {
|
73155
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
|
+
}
|
73156
73211
|
}
|
73157
73212
|
}
|
73158
73213
|
const unionType = propTypes.length ? getUnionType(propTypes, 2 /* Subtype */) : undefinedType;
|
73159
|
-
return createIndexInfo(
|
73214
|
+
return createIndexInfo(
|
73215
|
+
keyType,
|
73216
|
+
unionType,
|
73217
|
+
isReadonly,
|
73218
|
+
/*declaration*/
|
73219
|
+
void 0,
|
73220
|
+
components
|
73221
|
+
);
|
73160
73222
|
}
|
73161
73223
|
function getImmediateAliasedSymbol(symbol) {
|
73162
73224
|
Debug.assert((symbol.flags & 2097152 /* Alias */) !== 0, "Should only get Alias here.");
|
@@ -83862,7 +83924,7 @@ function createTypeChecker(host) {
|
|
83862
83924
|
const typeDeclaration = symbol.valueDeclaration;
|
83863
83925
|
if (typeDeclaration && isClassLike(typeDeclaration)) {
|
83864
83926
|
for (const member of typeDeclaration.members) {
|
83865
|
-
if (!isStatic(member) && !hasBindableName(member)) {
|
83927
|
+
if ((!isStaticIndex && !isStatic(member) || isStaticIndex && isStatic(member)) && !hasBindableName(member)) {
|
83866
83928
|
const symbol2 = getSymbolOfDeclaration(member);
|
83867
83929
|
checkIndexConstraintForProperty(type, symbol2, getTypeOfExpression(member.name.expression), getNonMissingTypeOfSymbol(symbol2));
|
83868
83930
|
}
|
@@ -87675,6 +87737,35 @@ function createTypeChecker(host) {
|
|
87675
87737
|
for (const info of infoList) {
|
87676
87738
|
if (info.declaration) continue;
|
87677
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
|
+
}
|
87678
87769
|
const node = nodeBuilder.indexInfoToIndexSignatureDeclaration(info, enclosing, flags, internalFlags, tracker);
|
87679
87770
|
if (node && infoList === staticInfos) {
|
87680
87771
|
(node.modifiers || (node.modifiers = factory.createNodeArray())).unshift(factory.createModifier(126 /* StaticKeyword */));
|
@@ -87685,6 +87776,22 @@ function createTypeChecker(host) {
|
|
87685
87776
|
}
|
87686
87777
|
}
|
87687
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
|
+
}
|
87688
87795
|
}
|
87689
87796
|
};
|
87690
87797
|
function isImportRequiredByAugmentation(node) {
|
@@ -88929,7 +89036,7 @@ function createTypeChecker(host) {
|
|
88929
89036
|
}
|
88930
89037
|
}
|
88931
89038
|
function checkGrammarForInvalidDynamicName(node, message) {
|
88932
|
-
if (isNonBindableDynamicName(node)) {
|
89039
|
+
if (isNonBindableDynamicName(node) && !isEntityNameExpression(isElementAccessExpression(node) ? skipParentheses(node.argumentExpression) : node.expression)) {
|
88933
89040
|
return grammarErrorOnNode(node, message);
|
88934
89041
|
}
|
88935
89042
|
}
|
package/lib/typescript.d.ts
CHANGED
@@ -6852,11 +6852,15 @@ declare namespace ts {
|
|
6852
6852
|
String = 0,
|
6853
6853
|
Number = 1,
|
6854
6854
|
}
|
6855
|
+
type ElementWithComputedPropertyName = (ClassElement | ObjectLiteralElement) & {
|
6856
|
+
name: ComputedPropertyName;
|
6857
|
+
};
|
6855
6858
|
interface IndexInfo {
|
6856
6859
|
keyType: Type;
|
6857
6860
|
type: Type;
|
6858
6861
|
isReadonly: boolean;
|
6859
6862
|
declaration?: IndexSignatureDeclaration;
|
6863
|
+
components?: ElementWithComputedPropertyName[];
|
6860
6864
|
}
|
6861
6865
|
enum InferencePriority {
|
6862
6866
|
None = 0,
|
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";
|
@@ -55867,7 +55867,7 @@ function createTypeChecker(host) {
|
|
55867
55867
|
function shouldWriteTypeOfFunctionSymbol() {
|
55868
55868
|
var _a3;
|
55869
55869
|
const isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */) && // typeof static method
|
55870
|
-
some(symbol.declarations, (declaration) => isStatic(declaration));
|
55870
|
+
some(symbol.declarations, (declaration) => isStatic(declaration) && !isLateBindableIndexSignature(getNameOfDeclaration(declaration)));
|
55871
55871
|
const isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol
|
55872
55872
|
forEach(symbol.declarations, (declaration) => declaration.parent.kind === 307 /* SourceFile */ || declaration.parent.kind === 268 /* ModuleBlock */));
|
55873
55873
|
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
|
@@ -56170,6 +56170,38 @@ function createTypeChecker(host) {
|
|
56170
56170
|
ids.unshift(state);
|
56171
56171
|
return ids;
|
56172
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
|
+
}
|
56173
56205
|
function createTypeNodesFromResolvedType(resolvedType) {
|
56174
56206
|
if (checkTruncationLength(context)) {
|
56175
56207
|
if (context.flags & 1 /* NoTruncation */) {
|
@@ -56194,7 +56226,7 @@ function createTypeChecker(host) {
|
|
56194
56226
|
typeElements.push(signatureToSignatureDeclarationHelper(signature, 180 /* ConstructSignature */, context));
|
56195
56227
|
}
|
56196
56228
|
for (const info of resolvedType.indexInfos) {
|
56197
|
-
typeElements.push(
|
56229
|
+
typeElements.push(...indexInfoToObjectComputedNamesOrSignatureDeclaration(info, context, resolvedType.objectFlags & 1024 /* ReverseMapped */ ? createElidedInformationPlaceholder(context) : void 0));
|
56198
56230
|
}
|
56199
56231
|
const properties = resolvedType.properties;
|
56200
56232
|
if (!properties) {
|
@@ -56883,7 +56915,7 @@ function createTypeChecker(host) {
|
|
56883
56915
|
if (!context.tracker.canTrackSymbol) return;
|
56884
56916
|
const firstIdentifier = getFirstIdentifier(accessExpression);
|
56885
56917
|
const name = resolveName(
|
56886
|
-
|
56918
|
+
enclosingDeclaration,
|
56887
56919
|
firstIdentifier.escapedText,
|
56888
56920
|
111551 /* Value */ | 1048576 /* ExportValue */,
|
56889
56921
|
/*nameNotFoundMessage*/
|
@@ -56893,6 +56925,19 @@ function createTypeChecker(host) {
|
|
56893
56925
|
);
|
56894
56926
|
if (name) {
|
56895
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
|
+
}
|
56896
56941
|
}
|
56897
56942
|
}
|
56898
56943
|
function lookupSymbolChain(symbol, context, meaning, yieldModuleSymbol) {
|
@@ -63707,8 +63752,8 @@ function createTypeChecker(host) {
|
|
63707
63752
|
function getIndexSymbolFromSymbolTable(symbolTable) {
|
63708
63753
|
return symbolTable.get("__index" /* Index */);
|
63709
63754
|
}
|
63710
|
-
function createIndexInfo(keyType, type, isReadonly, declaration) {
|
63711
|
-
return { keyType, type, isReadonly, declaration };
|
63755
|
+
function createIndexInfo(keyType, type, isReadonly, declaration, components) {
|
63756
|
+
return { keyType, type, isReadonly, declaration, components };
|
63712
63757
|
}
|
63713
63758
|
function getIndexInfosOfSymbol(symbol) {
|
63714
63759
|
const indexSymbol = getIndexSymbol(symbol);
|
@@ -66784,7 +66829,7 @@ function createTypeChecker(host) {
|
|
66784
66829
|
return result;
|
66785
66830
|
}
|
66786
66831
|
function getIndexInfoWithReadonly(info, readonly) {
|
66787
|
-
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;
|
66788
66833
|
}
|
66789
66834
|
function createLiteralType(flags, value, symbol, regularType) {
|
66790
66835
|
const type = createTypeWithSymbol(flags, symbol);
|
@@ -67574,7 +67619,7 @@ function createTypeChecker(host) {
|
|
67574
67619
|
return type.restrictiveInstantiation;
|
67575
67620
|
}
|
67576
67621
|
function instantiateIndexInfo(info, mapper) {
|
67577
|
-
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);
|
67578
67623
|
}
|
67579
67624
|
function isContextSensitive(node) {
|
67580
67625
|
Debug.assert(node.kind !== 174 /* MethodDeclaration */ || isObjectLiteralMethod(node));
|
@@ -71707,7 +71752,7 @@ function createTypeChecker(host) {
|
|
71707
71752
|
}
|
71708
71753
|
}
|
71709
71754
|
}
|
71710
|
-
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)));
|
71711
71756
|
result.objectFlags |= getObjectFlags(type) & (4096 /* JSLiteral */ | 262144 /* NonInferrableType */);
|
71712
71757
|
return result;
|
71713
71758
|
}
|
@@ -77757,16 +77802,33 @@ function createTypeChecker(host) {
|
|
77757
77802
|
const firstDecl = (_a = symbol.declarations) == null ? void 0 : _a[0];
|
77758
77803
|
return isKnownSymbol(symbol) || firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 4096 /* ESSymbol */);
|
77759
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
|
+
}
|
77760
77810
|
function getObjectLiteralIndexInfo(isReadonly, offset, properties, keyType) {
|
77811
|
+
var _a;
|
77761
77812
|
const propTypes = [];
|
77813
|
+
let components;
|
77762
77814
|
for (let i = offset; i < properties.length; i++) {
|
77763
77815
|
const prop = properties[i];
|
77764
77816
|
if (keyType === stringType && !isSymbolWithSymbolName(prop) || keyType === numberType && isSymbolWithNumericName(prop) || keyType === esSymbolType && isSymbolWithSymbolName(prop)) {
|
77765
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
|
+
}
|
77766
77821
|
}
|
77767
77822
|
}
|
77768
77823
|
const unionType = propTypes.length ? getUnionType(propTypes, 2 /* Subtype */) : undefinedType;
|
77769
|
-
return createIndexInfo(
|
77824
|
+
return createIndexInfo(
|
77825
|
+
keyType,
|
77826
|
+
unionType,
|
77827
|
+
isReadonly,
|
77828
|
+
/*declaration*/
|
77829
|
+
void 0,
|
77830
|
+
components
|
77831
|
+
);
|
77770
77832
|
}
|
77771
77833
|
function getImmediateAliasedSymbol(symbol) {
|
77772
77834
|
Debug.assert((symbol.flags & 2097152 /* Alias */) !== 0, "Should only get Alias here.");
|
@@ -88472,7 +88534,7 @@ function createTypeChecker(host) {
|
|
88472
88534
|
const typeDeclaration = symbol.valueDeclaration;
|
88473
88535
|
if (typeDeclaration && isClassLike(typeDeclaration)) {
|
88474
88536
|
for (const member of typeDeclaration.members) {
|
88475
|
-
if (!isStatic(member) && !hasBindableName(member)) {
|
88537
|
+
if ((!isStaticIndex && !isStatic(member) || isStaticIndex && isStatic(member)) && !hasBindableName(member)) {
|
88476
88538
|
const symbol2 = getSymbolOfDeclaration(member);
|
88477
88539
|
checkIndexConstraintForProperty(type, symbol2, getTypeOfExpression(member.name.expression), getNonMissingTypeOfSymbol(symbol2));
|
88478
88540
|
}
|
@@ -92285,6 +92347,35 @@ function createTypeChecker(host) {
|
|
92285
92347
|
for (const info of infoList) {
|
92286
92348
|
if (info.declaration) continue;
|
92287
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
|
+
}
|
92288
92379
|
const node = nodeBuilder.indexInfoToIndexSignatureDeclaration(info, enclosing, flags, internalFlags, tracker);
|
92289
92380
|
if (node && infoList === staticInfos) {
|
92290
92381
|
(node.modifiers || (node.modifiers = factory.createNodeArray())).unshift(factory.createModifier(126 /* StaticKeyword */));
|
@@ -92295,6 +92386,22 @@ function createTypeChecker(host) {
|
|
92295
92386
|
}
|
92296
92387
|
}
|
92297
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
|
+
}
|
92298
92405
|
}
|
92299
92406
|
};
|
92300
92407
|
function isImportRequiredByAugmentation(node) {
|
@@ -93539,7 +93646,7 @@ function createTypeChecker(host) {
|
|
93539
93646
|
}
|
93540
93647
|
}
|
93541
93648
|
function checkGrammarForInvalidDynamicName(node, message) {
|
93542
|
-
if (isNonBindableDynamicName(node)) {
|
93649
|
+
if (isNonBindableDynamicName(node) && !isEntityNameExpression(isElementAccessExpression(node) ? skipParentheses(node.argumentExpression) : node.expression)) {
|
93543
93650
|
return grammarErrorOnNode(node, message);
|
93544
93651
|
}
|
93545
93652
|
}
|
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
|
}
|