typescript 5.8.1-rc → 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 +44 -42
- package/lib/typescript.js +44 -42
- 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
|
}
|
@@ -85063,11 +85070,10 @@ function createTypeChecker(host) {
|
|
85063
85070
|
return;
|
85064
85071
|
}
|
85065
85072
|
checkGrammarModifiers(node);
|
85066
|
-
|
85067
|
-
if (compilerOptions.erasableSyntaxOnly && isImportEquals && !(node.flags & 33554432 /* Ambient */)) {
|
85073
|
+
if (compilerOptions.erasableSyntaxOnly && !(node.flags & 33554432 /* Ambient */)) {
|
85068
85074
|
error(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
85069
85075
|
}
|
85070
|
-
if (
|
85076
|
+
if (isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {
|
85071
85077
|
checkImportBinding(node);
|
85072
85078
|
markLinkedReferences(node, 6 /* ExportImportEquals */);
|
85073
85079
|
if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
|
@@ -85187,6 +85193,9 @@ function createTypeChecker(host) {
|
|
85187
85193
|
if (checkGrammarModuleElementContext(node, illegalContextMessage)) {
|
85188
85194
|
return;
|
85189
85195
|
}
|
85196
|
+
if (compilerOptions.erasableSyntaxOnly && node.isExportEquals && !(node.flags & 33554432 /* Ambient */)) {
|
85197
|
+
error(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
85198
|
+
}
|
85190
85199
|
const container = node.parent.kind === 307 /* SourceFile */ ? node.parent : node.parent.parent;
|
85191
85200
|
if (container.kind === 267 /* ModuleDeclaration */ && !isAmbientModule(container)) {
|
85192
85201
|
if (node.isExportEquals) {
|
@@ -131860,9 +131869,11 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
131860
131869
|
if (!resolver.canReuseTypeNode(context, node)) {
|
131861
131870
|
return resolver.serializeExistingTypeNode(context, node);
|
131862
131871
|
}
|
131872
|
+
const specifier = rewriteModuleSpecifier2(node, node.argument.literal);
|
131873
|
+
const literal = specifier === node.argument.literal ? reuseNode(context, node.argument.literal) : specifier;
|
131863
131874
|
return factory.updateImportTypeNode(
|
131864
131875
|
node,
|
131865
|
-
|
131876
|
+
literal === node.argument.literal ? reuseNode(context, node.argument) : factory.createLiteralTypeNode(literal),
|
131866
131877
|
visitNode(node.attributes, visitExistingNodeTreeSymbols, isImportAttributes),
|
131867
131878
|
visitNode(node.qualifier, visitExistingNodeTreeSymbols, isEntityName),
|
131868
131879
|
visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode),
|
@@ -132017,10 +132028,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
132017
132028
|
}
|
132018
132029
|
function rewriteModuleSpecifier2(parent, lit) {
|
132019
132030
|
const newName = resolver.getModuleSpecifierOverride(context, parent, lit);
|
132020
|
-
|
132021
|
-
return setOriginalNode(factory.createStringLiteral(newName), lit);
|
132022
|
-
}
|
132023
|
-
return visitNode(lit, visitExistingNodeTreeSymbols, isStringLiteral);
|
132031
|
+
return newName ? setOriginalNode(factory.createStringLiteral(newName), lit) : lit;
|
132024
132032
|
}
|
132025
132033
|
}
|
132026
132034
|
}
|
@@ -132187,12 +132195,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
132187
132195
|
return withNewScope(context, node, () => serializeTypeAnnotationOfDeclaration(accessorType, context, node, symbol) ?? inferTypeOfDeclaration(node, symbol, context));
|
132188
132196
|
}
|
132189
132197
|
if (accessorDeclarations.getAccessor) {
|
132190
|
-
return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(
|
132191
|
-
accessorDeclarations.getAccessor,
|
132192
|
-
/*symbol*/
|
132193
|
-
void 0,
|
132194
|
-
context
|
132195
|
-
));
|
132198
|
+
return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(accessorDeclarations.getAccessor, symbol, context));
|
132196
132199
|
}
|
132197
132200
|
return void 0;
|
132198
132201
|
}
|
@@ -132302,14 +132305,14 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
132302
132305
|
}
|
132303
132306
|
return resolver.serializeTypeOfExpression(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
132304
132307
|
}
|
132305
|
-
function inferReturnTypeOfSignatureSignature(node, context, reportFallback) {
|
132308
|
+
function inferReturnTypeOfSignatureSignature(node, context, symbol, reportFallback) {
|
132306
132309
|
if (reportFallback) {
|
132307
132310
|
context.tracker.reportInferenceFallback(node);
|
132308
132311
|
}
|
132309
132312
|
if (context.noInferenceFallback === true) {
|
132310
132313
|
return factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
132311
132314
|
}
|
132312
|
-
return resolver.serializeReturnTypeForSignature(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
132315
|
+
return resolver.serializeReturnTypeForSignature(context, node, symbol) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
132313
132316
|
}
|
132314
132317
|
function inferAccessorType(node, allAccessors, context, symbol, reportFallback = true) {
|
132315
132318
|
if (node.kind === 177 /* GetAccessor */) {
|
@@ -132599,18 +132602,17 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
132599
132602
|
);
|
132600
132603
|
}
|
132601
132604
|
function reuseTypeParameters(typeParameters, context) {
|
132602
|
-
return typeParameters == null ? void 0 : typeParameters.map(
|
132603
|
-
|
132604
|
-
|
132605
|
-
|
132606
|
-
|
132607
|
-
|
132608
|
-
|
132609
|
-
|
132610
|
-
|
132611
|
-
|
132612
|
-
|
132613
|
-
);
|
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
|
+
});
|
132614
132616
|
}
|
132615
132617
|
function typeFromObjectLiteralMethod(method, name, context, isConstContext) {
|
132616
132618
|
const returnType = createReturnFromSignature(
|
@@ -132745,7 +132747,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
132745
132747
|
} else if (isValueSignatureDeclaration(fn)) {
|
132746
132748
|
returnType = typeFromSingleReturnExpression(fn, context);
|
132747
132749
|
}
|
132748
|
-
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);
|
132749
132751
|
}
|
132750
132752
|
function typeFromSingleReturnExpression(declaration, context) {
|
132751
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
|
}
|
@@ -89673,11 +89680,10 @@ function createTypeChecker(host) {
|
|
89673
89680
|
return;
|
89674
89681
|
}
|
89675
89682
|
checkGrammarModifiers(node);
|
89676
|
-
|
89677
|
-
if (compilerOptions.erasableSyntaxOnly && isImportEquals && !(node.flags & 33554432 /* Ambient */)) {
|
89683
|
+
if (compilerOptions.erasableSyntaxOnly && !(node.flags & 33554432 /* Ambient */)) {
|
89678
89684
|
error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
89679
89685
|
}
|
89680
|
-
if (
|
89686
|
+
if (isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {
|
89681
89687
|
checkImportBinding(node);
|
89682
89688
|
markLinkedReferences(node, 6 /* ExportImportEquals */);
|
89683
89689
|
if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
|
@@ -89797,6 +89803,9 @@ function createTypeChecker(host) {
|
|
89797
89803
|
if (checkGrammarModuleElementContext(node, illegalContextMessage)) {
|
89798
89804
|
return;
|
89799
89805
|
}
|
89806
|
+
if (compilerOptions.erasableSyntaxOnly && node.isExportEquals && !(node.flags & 33554432 /* Ambient */)) {
|
89807
|
+
error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
|
89808
|
+
}
|
89800
89809
|
const container = node.parent.kind === 307 /* SourceFile */ ? node.parent : node.parent.parent;
|
89801
89810
|
if (container.kind === 267 /* ModuleDeclaration */ && !isAmbientModule(container)) {
|
89802
89811
|
if (node.isExportEquals) {
|
@@ -136827,9 +136836,11 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
136827
136836
|
if (!resolver.canReuseTypeNode(context, node)) {
|
136828
136837
|
return resolver.serializeExistingTypeNode(context, node);
|
136829
136838
|
}
|
136839
|
+
const specifier = rewriteModuleSpecifier2(node, node.argument.literal);
|
136840
|
+
const literal = specifier === node.argument.literal ? reuseNode(context, node.argument.literal) : specifier;
|
136830
136841
|
return factory.updateImportTypeNode(
|
136831
136842
|
node,
|
136832
|
-
|
136843
|
+
literal === node.argument.literal ? reuseNode(context, node.argument) : factory.createLiteralTypeNode(literal),
|
136833
136844
|
visitNode(node.attributes, visitExistingNodeTreeSymbols, isImportAttributes),
|
136834
136845
|
visitNode(node.qualifier, visitExistingNodeTreeSymbols, isEntityName),
|
136835
136846
|
visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode),
|
@@ -136984,10 +136995,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
136984
136995
|
}
|
136985
136996
|
function rewriteModuleSpecifier2(parent2, lit) {
|
136986
136997
|
const newName = resolver.getModuleSpecifierOverride(context, parent2, lit);
|
136987
|
-
|
136988
|
-
return setOriginalNode(factory.createStringLiteral(newName), lit);
|
136989
|
-
}
|
136990
|
-
return visitNode(lit, visitExistingNodeTreeSymbols, isStringLiteral);
|
136998
|
+
return newName ? setOriginalNode(factory.createStringLiteral(newName), lit) : lit;
|
136991
136999
|
}
|
136992
137000
|
}
|
136993
137001
|
}
|
@@ -137154,12 +137162,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
137154
137162
|
return withNewScope(context, node, () => serializeTypeAnnotationOfDeclaration(accessorType, context, node, symbol) ?? inferTypeOfDeclaration(node, symbol, context));
|
137155
137163
|
}
|
137156
137164
|
if (accessorDeclarations.getAccessor) {
|
137157
|
-
return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(
|
137158
|
-
accessorDeclarations.getAccessor,
|
137159
|
-
/*symbol*/
|
137160
|
-
void 0,
|
137161
|
-
context
|
137162
|
-
));
|
137165
|
+
return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(accessorDeclarations.getAccessor, symbol, context));
|
137163
137166
|
}
|
137164
137167
|
return void 0;
|
137165
137168
|
}
|
@@ -137269,14 +137272,14 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
137269
137272
|
}
|
137270
137273
|
return resolver.serializeTypeOfExpression(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
137271
137274
|
}
|
137272
|
-
function inferReturnTypeOfSignatureSignature(node, context, reportFallback) {
|
137275
|
+
function inferReturnTypeOfSignatureSignature(node, context, symbol, reportFallback) {
|
137273
137276
|
if (reportFallback) {
|
137274
137277
|
context.tracker.reportInferenceFallback(node);
|
137275
137278
|
}
|
137276
137279
|
if (context.noInferenceFallback === true) {
|
137277
137280
|
return factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
137278
137281
|
}
|
137279
|
-
return resolver.serializeReturnTypeForSignature(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
137282
|
+
return resolver.serializeReturnTypeForSignature(context, node, symbol) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
137280
137283
|
}
|
137281
137284
|
function inferAccessorType(node, allAccessors, context, symbol, reportFallback = true) {
|
137282
137285
|
if (node.kind === 177 /* GetAccessor */) {
|
@@ -137566,18 +137569,17 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
137566
137569
|
);
|
137567
137570
|
}
|
137568
137571
|
function reuseTypeParameters(typeParameters, context) {
|
137569
|
-
return typeParameters == null ? void 0 : typeParameters.map(
|
137570
|
-
|
137571
|
-
|
137572
|
-
|
137573
|
-
|
137574
|
-
|
137575
|
-
|
137576
|
-
|
137577
|
-
|
137578
|
-
|
137579
|
-
|
137580
|
-
);
|
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
|
+
});
|
137581
137583
|
}
|
137582
137584
|
function typeFromObjectLiteralMethod(method, name, context, isConstContext) {
|
137583
137585
|
const returnType = createReturnFromSignature(
|
@@ -137712,7 +137714,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
137712
137714
|
} else if (isValueSignatureDeclaration(fn)) {
|
137713
137715
|
returnType = typeFromSingleReturnExpression(fn, context);
|
137714
137716
|
}
|
137715
|
-
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);
|
137716
137718
|
}
|
137717
137719
|
function typeFromSingleReturnExpression(declaration, context) {
|
137718
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
|
}
|