typescript 5.8.2 → 5.8.3
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 +39 -39
- package/lib/typescript.js +39 -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 = "5.8.
|
21
|
+
var version = "5.8.3";
|
22
22
|
|
23
23
|
// src/compiler/core.ts
|
24
24
|
var emptyArray = [];
|
@@ -50405,10 +50405,11 @@ function createTypeChecker(host) {
|
|
50405
50405
|
serializeExistingTypeNode(context, typeNode, addUndefined) {
|
50406
50406
|
return serializeExistingTypeNode(context, typeNode, !!addUndefined);
|
50407
50407
|
},
|
50408
|
-
serializeReturnTypeForSignature(syntacticContext, signatureDeclaration) {
|
50408
|
+
serializeReturnTypeForSignature(syntacticContext, signatureDeclaration, symbol) {
|
50409
50409
|
const context = syntacticContext;
|
50410
50410
|
const signature = getSignatureFromDeclaration(signatureDeclaration);
|
50411
|
-
|
50411
|
+
symbol ?? (symbol = getSymbolOfDeclaration(signatureDeclaration));
|
50412
|
+
const returnType = context.enclosingSymbolTypes.get(getSymbolId(symbol)) ?? instantiateType(getReturnTypeOfSignature(signature), context.mapper);
|
50412
50413
|
return serializeInferredReturnTypeForSignature(context, signature, returnType);
|
50413
50414
|
},
|
50414
50415
|
serializeTypeOfExpression(syntacticContext, expr) {
|
@@ -50422,7 +50423,7 @@ function createTypeChecker(host) {
|
|
50422
50423
|
symbol ?? (symbol = getSymbolOfDeclaration(declaration));
|
50423
50424
|
let type = (_a = context.enclosingSymbolTypes) == null ? void 0 : _a.get(getSymbolId(symbol));
|
50424
50425
|
if (type === void 0) {
|
50425
|
-
type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? instantiateType(getWidenedLiteralType(getTypeOfSymbol(symbol)), context.mapper) : errorType;
|
50426
|
+
type = symbol.flags & 98304 /* Accessor */ && declaration.kind === 178 /* SetAccessor */ ? instantiateType(getWriteTypeOfSymbol(symbol), context.mapper) : symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? instantiateType(getWidenedLiteralType(getTypeOfSymbol(symbol)), context.mapper) : errorType;
|
50426
50427
|
}
|
50427
50428
|
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
|
50428
50429
|
if (addUndefinedForParameter) {
|
@@ -50482,6 +50483,7 @@ function createTypeChecker(host) {
|
|
50482
50483
|
const context = syntacticContext;
|
50483
50484
|
if (context.bundled || context.enclosingFile !== getSourceFileOfNode(lit)) {
|
50484
50485
|
let name = lit.text;
|
50486
|
+
const originalName = name;
|
50485
50487
|
const nodeSymbol = getNodeLinks(parent).resolvedSymbol;
|
50486
50488
|
const meaning = parent.isTypeOf ? 111551 /* Value */ : 788968 /* Type */;
|
50487
50489
|
const parentSymbol = nodeSymbol && isSymbolAccessible(
|
@@ -50511,7 +50513,9 @@ function createTypeChecker(host) {
|
|
50511
50513
|
context.tracker.reportLikelyUnsafeImportRequiredError(name);
|
50512
50514
|
}
|
50513
50515
|
}
|
50514
|
-
|
50516
|
+
if (name !== originalName) {
|
50517
|
+
return name;
|
50518
|
+
}
|
50515
50519
|
}
|
50516
50520
|
},
|
50517
50521
|
canReuseTypeNode(context, typeNode) {
|
@@ -51568,12 +51572,13 @@ function createTypeChecker(host) {
|
|
51568
51572
|
if (propertySymbol.flags & 98304 /* Accessor */) {
|
51569
51573
|
const writeType = getWriteTypeOfSymbol(propertySymbol);
|
51570
51574
|
if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) {
|
51575
|
+
const symbolMapper = getSymbolLinks(propertySymbol).mapper;
|
51571
51576
|
const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
|
51572
51577
|
const getterSignature = getSignatureFromDeclaration(getterDeclaration);
|
51573
51578
|
typeElements.push(
|
51574
51579
|
setCommentRange2(
|
51575
51580
|
context,
|
51576
|
-
signatureToSignatureDeclarationHelper(getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
|
51581
|
+
signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(getterSignature, symbolMapper) : getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
|
51577
51582
|
getterDeclaration
|
51578
51583
|
)
|
51579
51584
|
);
|
@@ -51582,7 +51587,7 @@ function createTypeChecker(host) {
|
|
51582
51587
|
typeElements.push(
|
51583
51588
|
setCommentRange2(
|
51584
51589
|
context,
|
51585
|
-
signatureToSignatureDeclarationHelper(setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
|
51590
|
+
signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(setterSignature, symbolMapper) : setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
|
51586
51591
|
setterDeclaration
|
51587
51592
|
)
|
51588
51593
|
);
|
@@ -52725,13 +52730,13 @@ function createTypeChecker(host) {
|
|
52725
52730
|
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
|
52726
52731
|
const decl = declaration ?? symbol.valueDeclaration ?? getDeclarationWithTypeAnnotation(symbol) ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
|
52727
52732
|
if (decl) {
|
52733
|
+
const restore = addSymbolTypeToContext(context, symbol, type);
|
52728
52734
|
if (isAccessor(decl)) {
|
52729
52735
|
result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol, context);
|
52730
52736
|
} else if (hasInferredType(decl) && !nodeIsSynthesized(decl) && !(getObjectFlags(type) & 196608 /* RequiresWidening */)) {
|
52731
|
-
const restore = addSymbolTypeToContext(context, symbol, type);
|
52732
52737
|
result = syntacticNodeBuilder.serializeTypeOfDeclaration(decl, symbol, context);
|
52733
|
-
restore();
|
52734
52738
|
}
|
52739
|
+
restore();
|
52735
52740
|
}
|
52736
52741
|
if (!result) {
|
52737
52742
|
if (addUndefinedForParameter) {
|
@@ -52885,10 +52890,7 @@ function createTypeChecker(host) {
|
|
52885
52890
|
/*context*/
|
52886
52891
|
void 0
|
52887
52892
|
);
|
52888
|
-
|
52889
|
-
setTextRange2(context, updated, node2);
|
52890
|
-
}
|
52891
|
-
return updated;
|
52893
|
+
return setTextRange2(context, updated, node2);
|
52892
52894
|
}
|
52893
52895
|
}
|
52894
52896
|
function serializeTypeName(context, node, isTypeOf, typeArguments) {
|
@@ -76781,6 +76783,11 @@ function createTypeChecker(host) {
|
|
76781
76783
|
if (file && fileExtensionIsOneOf(file.fileName, [".cts" /* Cts */, ".mts" /* Mts */])) {
|
76782
76784
|
grammarErrorOnNode(node, Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead);
|
76783
76785
|
}
|
76786
|
+
if (compilerOptions.erasableSyntaxOnly) {
|
76787
|
+
const start = skipTrivia(file.text, node.pos);
|
76788
|
+
const end = node.expression.pos;
|
76789
|
+
diagnostics.add(createFileDiagnostic(file, start, end - start, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled));
|
76790
|
+
}
|
76784
76791
|
}
|
76785
76792
|
return checkAssertionWorker(node, checkMode);
|
76786
76793
|
}
|
@@ -131862,9 +131869,11 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
131862
131869
|
if (!resolver.canReuseTypeNode(context, node)) {
|
131863
131870
|
return resolver.serializeExistingTypeNode(context, node);
|
131864
131871
|
}
|
131872
|
+
const specifier = rewriteModuleSpecifier2(node, node.argument.literal);
|
131873
|
+
const literal = specifier === node.argument.literal ? reuseNode(context, node.argument.literal) : specifier;
|
131865
131874
|
return factory.updateImportTypeNode(
|
131866
131875
|
node,
|
131867
|
-
|
131876
|
+
literal === node.argument.literal ? reuseNode(context, node.argument) : factory.createLiteralTypeNode(literal),
|
131868
131877
|
visitNode(node.attributes, visitExistingNodeTreeSymbols, isImportAttributes),
|
131869
131878
|
visitNode(node.qualifier, visitExistingNodeTreeSymbols, isEntityName),
|
131870
131879
|
visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode),
|
@@ -132019,10 +132028,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
132019
132028
|
}
|
132020
132029
|
function rewriteModuleSpecifier2(parent, lit) {
|
132021
132030
|
const newName = resolver.getModuleSpecifierOverride(context, parent, lit);
|
132022
|
-
|
132023
|
-
return setOriginalNode(factory.createStringLiteral(newName), lit);
|
132024
|
-
}
|
132025
|
-
return visitNode(lit, visitExistingNodeTreeSymbols, isStringLiteral);
|
132031
|
+
return newName ? setOriginalNode(factory.createStringLiteral(newName), lit) : lit;
|
132026
132032
|
}
|
132027
132033
|
}
|
132028
132034
|
}
|
@@ -132189,12 +132195,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
132189
132195
|
return withNewScope(context, node, () => serializeTypeAnnotationOfDeclaration(accessorType, context, node, symbol) ?? inferTypeOfDeclaration(node, symbol, context));
|
132190
132196
|
}
|
132191
132197
|
if (accessorDeclarations.getAccessor) {
|
132192
|
-
return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(
|
132193
|
-
accessorDeclarations.getAccessor,
|
132194
|
-
/*symbol*/
|
132195
|
-
void 0,
|
132196
|
-
context
|
132197
|
-
));
|
132198
|
+
return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(accessorDeclarations.getAccessor, symbol, context));
|
132198
132199
|
}
|
132199
132200
|
return void 0;
|
132200
132201
|
}
|
@@ -132304,14 +132305,14 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
132304
132305
|
}
|
132305
132306
|
return resolver.serializeTypeOfExpression(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
132306
132307
|
}
|
132307
|
-
function inferReturnTypeOfSignatureSignature(node, context, reportFallback) {
|
132308
|
+
function inferReturnTypeOfSignatureSignature(node, context, symbol, reportFallback) {
|
132308
132309
|
if (reportFallback) {
|
132309
132310
|
context.tracker.reportInferenceFallback(node);
|
132310
132311
|
}
|
132311
132312
|
if (context.noInferenceFallback === true) {
|
132312
132313
|
return factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
132313
132314
|
}
|
132314
|
-
return resolver.serializeReturnTypeForSignature(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
132315
|
+
return resolver.serializeReturnTypeForSignature(context, node, symbol) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
132315
132316
|
}
|
132316
132317
|
function inferAccessorType(node, allAccessors, context, symbol, reportFallback = true) {
|
132317
132318
|
if (node.kind === 177 /* GetAccessor */) {
|
@@ -132601,18 +132602,17 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
132601
132602
|
);
|
132602
132603
|
}
|
132603
132604
|
function reuseTypeParameters(typeParameters, context) {
|
132604
|
-
return typeParameters == null ? void 0 : typeParameters.map(
|
132605
|
-
|
132606
|
-
|
132607
|
-
|
132608
|
-
|
132609
|
-
|
132610
|
-
|
132611
|
-
|
132612
|
-
|
132613
|
-
|
132614
|
-
|
132615
|
-
);
|
132605
|
+
return typeParameters == null ? void 0 : typeParameters.map((tp) => {
|
132606
|
+
var _a;
|
132607
|
+
const { node: tpName } = resolver.trackExistingEntityName(context, tp.name);
|
132608
|
+
return factory.updateTypeParameterDeclaration(
|
132609
|
+
tp,
|
132610
|
+
(_a = tp.modifiers) == null ? void 0 : _a.map((m) => reuseNode(context, m)),
|
132611
|
+
tpName,
|
132612
|
+
serializeExistingTypeNodeWithFallback(tp.constraint, context),
|
132613
|
+
serializeExistingTypeNodeWithFallback(tp.default, context)
|
132614
|
+
);
|
132615
|
+
});
|
132616
132616
|
}
|
132617
132617
|
function typeFromObjectLiteralMethod(method, name, context, isConstContext) {
|
132618
132618
|
const returnType = createReturnFromSignature(
|
@@ -132747,7 +132747,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
132747
132747
|
} else if (isValueSignatureDeclaration(fn)) {
|
132748
132748
|
returnType = typeFromSingleReturnExpression(fn, context);
|
132749
132749
|
}
|
132750
|
-
return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context, reportFallback && returnType.reportFallback && !returnTypeNode);
|
132750
|
+
return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context, symbol, reportFallback && returnType.reportFallback && !returnTypeNode);
|
132751
132751
|
}
|
132752
132752
|
function typeFromSingleReturnExpression(declaration, context) {
|
132753
132753
|
let candidateExpr;
|
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 = "5.8.
|
2288
|
+
var version = "5.8.3";
|
2289
2289
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
2290
2290
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
2291
2291
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
@@ -55015,10 +55015,11 @@ function createTypeChecker(host) {
|
|
55015
55015
|
serializeExistingTypeNode(context, typeNode, addUndefined) {
|
55016
55016
|
return serializeExistingTypeNode(context, typeNode, !!addUndefined);
|
55017
55017
|
},
|
55018
|
-
serializeReturnTypeForSignature(syntacticContext, signatureDeclaration) {
|
55018
|
+
serializeReturnTypeForSignature(syntacticContext, signatureDeclaration, symbol) {
|
55019
55019
|
const context = syntacticContext;
|
55020
55020
|
const signature = getSignatureFromDeclaration(signatureDeclaration);
|
55021
|
-
|
55021
|
+
symbol ?? (symbol = getSymbolOfDeclaration(signatureDeclaration));
|
55022
|
+
const returnType = context.enclosingSymbolTypes.get(getSymbolId(symbol)) ?? instantiateType(getReturnTypeOfSignature(signature), context.mapper);
|
55022
55023
|
return serializeInferredReturnTypeForSignature(context, signature, returnType);
|
55023
55024
|
},
|
55024
55025
|
serializeTypeOfExpression(syntacticContext, expr) {
|
@@ -55032,7 +55033,7 @@ function createTypeChecker(host) {
|
|
55032
55033
|
symbol ?? (symbol = getSymbolOfDeclaration(declaration));
|
55033
55034
|
let type = (_a = context.enclosingSymbolTypes) == null ? void 0 : _a.get(getSymbolId(symbol));
|
55034
55035
|
if (type === void 0) {
|
55035
|
-
type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? instantiateType(getWidenedLiteralType(getTypeOfSymbol(symbol)), context.mapper) : errorType;
|
55036
|
+
type = symbol.flags & 98304 /* Accessor */ && declaration.kind === 178 /* SetAccessor */ ? instantiateType(getWriteTypeOfSymbol(symbol), context.mapper) : symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? instantiateType(getWidenedLiteralType(getTypeOfSymbol(symbol)), context.mapper) : errorType;
|
55036
55037
|
}
|
55037
55038
|
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
|
55038
55039
|
if (addUndefinedForParameter) {
|
@@ -55092,6 +55093,7 @@ function createTypeChecker(host) {
|
|
55092
55093
|
const context = syntacticContext;
|
55093
55094
|
if (context.bundled || context.enclosingFile !== getSourceFileOfNode(lit)) {
|
55094
55095
|
let name = lit.text;
|
55096
|
+
const originalName = name;
|
55095
55097
|
const nodeSymbol = getNodeLinks(parent2).resolvedSymbol;
|
55096
55098
|
const meaning = parent2.isTypeOf ? 111551 /* Value */ : 788968 /* Type */;
|
55097
55099
|
const parentSymbol = nodeSymbol && isSymbolAccessible(
|
@@ -55121,7 +55123,9 @@ function createTypeChecker(host) {
|
|
55121
55123
|
context.tracker.reportLikelyUnsafeImportRequiredError(name);
|
55122
55124
|
}
|
55123
55125
|
}
|
55124
|
-
|
55126
|
+
if (name !== originalName) {
|
55127
|
+
return name;
|
55128
|
+
}
|
55125
55129
|
}
|
55126
55130
|
},
|
55127
55131
|
canReuseTypeNode(context, typeNode) {
|
@@ -56178,12 +56182,13 @@ function createTypeChecker(host) {
|
|
56178
56182
|
if (propertySymbol.flags & 98304 /* Accessor */) {
|
56179
56183
|
const writeType = getWriteTypeOfSymbol(propertySymbol);
|
56180
56184
|
if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) {
|
56185
|
+
const symbolMapper = getSymbolLinks(propertySymbol).mapper;
|
56181
56186
|
const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
|
56182
56187
|
const getterSignature = getSignatureFromDeclaration(getterDeclaration);
|
56183
56188
|
typeElements.push(
|
56184
56189
|
setCommentRange2(
|
56185
56190
|
context,
|
56186
|
-
signatureToSignatureDeclarationHelper(getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
|
56191
|
+
signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(getterSignature, symbolMapper) : getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
|
56187
56192
|
getterDeclaration
|
56188
56193
|
)
|
56189
56194
|
);
|
@@ -56192,7 +56197,7 @@ function createTypeChecker(host) {
|
|
56192
56197
|
typeElements.push(
|
56193
56198
|
setCommentRange2(
|
56194
56199
|
context,
|
56195
|
-
signatureToSignatureDeclarationHelper(setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
|
56200
|
+
signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(setterSignature, symbolMapper) : setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
|
56196
56201
|
setterDeclaration
|
56197
56202
|
)
|
56198
56203
|
);
|
@@ -57335,13 +57340,13 @@ function createTypeChecker(host) {
|
|
57335
57340
|
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
|
57336
57341
|
const decl = declaration ?? symbol.valueDeclaration ?? getDeclarationWithTypeAnnotation(symbol) ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
|
57337
57342
|
if (decl) {
|
57343
|
+
const restore = addSymbolTypeToContext(context, symbol, type);
|
57338
57344
|
if (isAccessor(decl)) {
|
57339
57345
|
result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol, context);
|
57340
57346
|
} else if (hasInferredType(decl) && !nodeIsSynthesized(decl) && !(getObjectFlags(type) & 196608 /* RequiresWidening */)) {
|
57341
|
-
const restore = addSymbolTypeToContext(context, symbol, type);
|
57342
57347
|
result = syntacticNodeBuilder.serializeTypeOfDeclaration(decl, symbol, context);
|
57343
|
-
restore();
|
57344
57348
|
}
|
57349
|
+
restore();
|
57345
57350
|
}
|
57346
57351
|
if (!result) {
|
57347
57352
|
if (addUndefinedForParameter) {
|
@@ -57495,10 +57500,7 @@ function createTypeChecker(host) {
|
|
57495
57500
|
/*context*/
|
57496
57501
|
void 0
|
57497
57502
|
);
|
57498
|
-
|
57499
|
-
setTextRange2(context, updated, node2);
|
57500
|
-
}
|
57501
|
-
return updated;
|
57503
|
+
return setTextRange2(context, updated, node2);
|
57502
57504
|
}
|
57503
57505
|
}
|
57504
57506
|
function serializeTypeName(context, node, isTypeOf, typeArguments) {
|
@@ -81391,6 +81393,11 @@ function createTypeChecker(host) {
|
|
81391
81393
|
if (file && fileExtensionIsOneOf(file.fileName, [".cts" /* Cts */, ".mts" /* Mts */])) {
|
81392
81394
|
grammarErrorOnNode(node, Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead);
|
81393
81395
|
}
|
81396
|
+
if (compilerOptions.erasableSyntaxOnly) {
|
81397
|
+
const start = skipTrivia(file.text, node.pos);
|
81398
|
+
const end = node.expression.pos;
|
81399
|
+
diagnostics.add(createFileDiagnostic(file, start, end - start, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled));
|
81400
|
+
}
|
81394
81401
|
}
|
81395
81402
|
return checkAssertionWorker(node, checkMode);
|
81396
81403
|
}
|
@@ -136829,9 +136836,11 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
136829
136836
|
if (!resolver.canReuseTypeNode(context, node)) {
|
136830
136837
|
return resolver.serializeExistingTypeNode(context, node);
|
136831
136838
|
}
|
136839
|
+
const specifier = rewriteModuleSpecifier2(node, node.argument.literal);
|
136840
|
+
const literal = specifier === node.argument.literal ? reuseNode(context, node.argument.literal) : specifier;
|
136832
136841
|
return factory.updateImportTypeNode(
|
136833
136842
|
node,
|
136834
|
-
|
136843
|
+
literal === node.argument.literal ? reuseNode(context, node.argument) : factory.createLiteralTypeNode(literal),
|
136835
136844
|
visitNode(node.attributes, visitExistingNodeTreeSymbols, isImportAttributes),
|
136836
136845
|
visitNode(node.qualifier, visitExistingNodeTreeSymbols, isEntityName),
|
136837
136846
|
visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode),
|
@@ -136986,10 +136995,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
136986
136995
|
}
|
136987
136996
|
function rewriteModuleSpecifier2(parent2, lit) {
|
136988
136997
|
const newName = resolver.getModuleSpecifierOverride(context, parent2, lit);
|
136989
|
-
|
136990
|
-
return setOriginalNode(factory.createStringLiteral(newName), lit);
|
136991
|
-
}
|
136992
|
-
return visitNode(lit, visitExistingNodeTreeSymbols, isStringLiteral);
|
136998
|
+
return newName ? setOriginalNode(factory.createStringLiteral(newName), lit) : lit;
|
136993
136999
|
}
|
136994
137000
|
}
|
136995
137001
|
}
|
@@ -137156,12 +137162,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
137156
137162
|
return withNewScope(context, node, () => serializeTypeAnnotationOfDeclaration(accessorType, context, node, symbol) ?? inferTypeOfDeclaration(node, symbol, context));
|
137157
137163
|
}
|
137158
137164
|
if (accessorDeclarations.getAccessor) {
|
137159
|
-
return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(
|
137160
|
-
accessorDeclarations.getAccessor,
|
137161
|
-
/*symbol*/
|
137162
|
-
void 0,
|
137163
|
-
context
|
137164
|
-
));
|
137165
|
+
return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(accessorDeclarations.getAccessor, symbol, context));
|
137165
137166
|
}
|
137166
137167
|
return void 0;
|
137167
137168
|
}
|
@@ -137271,14 +137272,14 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
137271
137272
|
}
|
137272
137273
|
return resolver.serializeTypeOfExpression(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
137273
137274
|
}
|
137274
|
-
function inferReturnTypeOfSignatureSignature(node, context, reportFallback) {
|
137275
|
+
function inferReturnTypeOfSignatureSignature(node, context, symbol, reportFallback) {
|
137275
137276
|
if (reportFallback) {
|
137276
137277
|
context.tracker.reportInferenceFallback(node);
|
137277
137278
|
}
|
137278
137279
|
if (context.noInferenceFallback === true) {
|
137279
137280
|
return factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
137280
137281
|
}
|
137281
|
-
return resolver.serializeReturnTypeForSignature(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
137282
|
+
return resolver.serializeReturnTypeForSignature(context, node, symbol) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
137282
137283
|
}
|
137283
137284
|
function inferAccessorType(node, allAccessors, context, symbol, reportFallback = true) {
|
137284
137285
|
if (node.kind === 177 /* GetAccessor */) {
|
@@ -137568,18 +137569,17 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
137568
137569
|
);
|
137569
137570
|
}
|
137570
137571
|
function reuseTypeParameters(typeParameters, context) {
|
137571
|
-
return typeParameters == null ? void 0 : typeParameters.map(
|
137572
|
-
|
137573
|
-
|
137574
|
-
|
137575
|
-
|
137576
|
-
|
137577
|
-
|
137578
|
-
|
137579
|
-
|
137580
|
-
|
137581
|
-
|
137582
|
-
);
|
137572
|
+
return typeParameters == null ? void 0 : typeParameters.map((tp) => {
|
137573
|
+
var _a;
|
137574
|
+
const { node: tpName } = resolver.trackExistingEntityName(context, tp.name);
|
137575
|
+
return factory.updateTypeParameterDeclaration(
|
137576
|
+
tp,
|
137577
|
+
(_a = tp.modifiers) == null ? void 0 : _a.map((m) => reuseNode(context, m)),
|
137578
|
+
tpName,
|
137579
|
+
serializeExistingTypeNodeWithFallback(tp.constraint, context),
|
137580
|
+
serializeExistingTypeNodeWithFallback(tp.default, context)
|
137581
|
+
);
|
137582
|
+
});
|
137583
137583
|
}
|
137584
137584
|
function typeFromObjectLiteralMethod(method, name, context, isConstContext) {
|
137585
137585
|
const returnType = createReturnFromSignature(
|
@@ -137714,7 +137714,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
137714
137714
|
} else if (isValueSignatureDeclaration(fn)) {
|
137715
137715
|
returnType = typeFromSingleReturnExpression(fn, context);
|
137716
137716
|
}
|
137717
|
-
return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context, reportFallback && returnType.reportFallback && !returnTypeNode);
|
137717
|
+
return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context, symbol, reportFallback && returnType.reportFallback && !returnTypeNode);
|
137718
137718
|
}
|
137719
137719
|
function typeFromSingleReturnExpression(declaration, context) {
|
137720
137720
|
let candidateExpr;
|
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.
|
5
|
+
"version": "5.8.3",
|
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": "68cead182cc24afdc3f1ce7c8ff5853aba14b65a"
|
120
120
|
}
|