typescript 5.6.0-dev.20240709 → 5.6.0-dev.20240711
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 +27 -16
- package/lib/typescript.js +36 -18
- 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.6";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240711`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -8550,6 +8550,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
8550
8550
|
hasExtendedUnicodeEscape: () => (tokenFlags & 8 /* ExtendedUnicodeEscape */) !== 0,
|
|
8551
8551
|
hasPrecedingLineBreak: () => (tokenFlags & 1 /* PrecedingLineBreak */) !== 0,
|
|
8552
8552
|
hasPrecedingJSDocComment: () => (tokenFlags & 2 /* PrecedingJSDocComment */) !== 0,
|
|
8553
|
+
hasPrecedingJSDocLeadingAsterisks: () => (tokenFlags & 32768 /* PrecedingJSDocLeadingAsterisks */) !== 0,
|
|
8553
8554
|
isIdentifier: () => token === 80 /* Identifier */ || token > 118 /* LastReservedWord */,
|
|
8554
8555
|
isReservedWord: () => token >= 83 /* FirstReservedWord */ && token <= 118 /* LastReservedWord */,
|
|
8555
8556
|
isUnterminated: () => (tokenFlags & 4 /* Unterminated */) !== 0,
|
|
@@ -9190,7 +9191,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9190
9191
|
function scan() {
|
|
9191
9192
|
fullStartPos = pos;
|
|
9192
9193
|
tokenFlags = 0 /* None */;
|
|
9193
|
-
let asteriskSeen = false;
|
|
9194
9194
|
while (true) {
|
|
9195
9195
|
tokenStart = pos;
|
|
9196
9196
|
if (pos >= end) {
|
|
@@ -9306,8 +9306,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9306
9306
|
return pos += 2, token = 43 /* AsteriskAsteriskToken */;
|
|
9307
9307
|
}
|
|
9308
9308
|
pos++;
|
|
9309
|
-
if (skipJsDocLeadingAsterisks &&
|
|
9310
|
-
|
|
9309
|
+
if (skipJsDocLeadingAsterisks && (tokenFlags & 32768 /* PrecedingJSDocLeadingAsterisks */) === 0 && tokenFlags & 1 /* PrecedingLineBreak */) {
|
|
9310
|
+
tokenFlags |= 32768 /* PrecedingJSDocLeadingAsterisks */;
|
|
9311
9311
|
continue;
|
|
9312
9312
|
}
|
|
9313
9313
|
return token = 42 /* AsteriskToken */;
|
|
@@ -28948,7 +28948,7 @@ var Parser;
|
|
|
28948
28948
|
function createIdentifier(isIdentifier3, diagnosticMessage, privateIdentifierDiagnosticMessage) {
|
|
28949
28949
|
if (isIdentifier3) {
|
|
28950
28950
|
identifierCount++;
|
|
28951
|
-
const pos = getNodePos();
|
|
28951
|
+
const pos = scanner.hasPrecedingJSDocLeadingAsterisks() ? scanner.getTokenStart() : getNodePos();
|
|
28952
28952
|
const originalKeywordKind = token();
|
|
28953
28953
|
const text = internIdentifier(scanner.getTokenValue());
|
|
28954
28954
|
const hasExtendedUnicodeEscape = scanner.hasExtendedUnicodeEscape();
|
|
@@ -36078,6 +36078,7 @@ var commandOptionsWithoutBuild = [
|
|
|
36078
36078
|
type: "boolean",
|
|
36079
36079
|
affectsEmit: true,
|
|
36080
36080
|
affectsBuildInfo: true,
|
|
36081
|
+
affectsSourceFile: true,
|
|
36081
36082
|
category: Diagnostics.Emit,
|
|
36082
36083
|
description: Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
|
|
36083
36084
|
defaultValueDescription: false
|
|
@@ -36542,6 +36543,7 @@ var commandOptionsWithoutBuild = [
|
|
|
36542
36543
|
affectsEmit: true,
|
|
36543
36544
|
affectsBuildInfo: true,
|
|
36544
36545
|
affectsModuleResolution: true,
|
|
36546
|
+
affectsSourceFile: true,
|
|
36545
36547
|
category: Diagnostics.Language_and_Environment,
|
|
36546
36548
|
description: Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
|
|
36547
36549
|
defaultValueDescription: "react"
|
|
@@ -49430,11 +49432,11 @@ function createTypeChecker(host) {
|
|
|
49430
49432
|
function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined) {
|
|
49431
49433
|
const originalType = type;
|
|
49432
49434
|
if (addUndefined) {
|
|
49433
|
-
type = getOptionalType(type);
|
|
49435
|
+
type = getOptionalType(type, !isParameter(host2));
|
|
49434
49436
|
}
|
|
49435
49437
|
const clone = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2);
|
|
49436
49438
|
if (clone) {
|
|
49437
|
-
if (addUndefined && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
|
|
49439
|
+
if (addUndefined && containsNonMissingUndefinedType(type) && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
|
|
49438
49440
|
return factory.createUnionTypeNode([clone, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
49439
49441
|
}
|
|
49440
49442
|
return clone;
|
|
@@ -51381,8 +51383,8 @@ function createTypeChecker(host) {
|
|
|
51381
51383
|
return enclosingDeclaration;
|
|
51382
51384
|
}
|
|
51383
51385
|
function serializeTypeForDeclaration(context, declaration, type, symbol) {
|
|
51384
|
-
var _a;
|
|
51385
|
-
const
|
|
51386
|
+
var _a, _b;
|
|
51387
|
+
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
51386
51388
|
const enclosingDeclaration = context.enclosingDeclaration;
|
|
51387
51389
|
const oldFlags = context.flags;
|
|
51388
51390
|
if (declaration && hasInferredType(declaration) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
|
|
@@ -51393,6 +51395,7 @@ function createTypeChecker(host) {
|
|
|
51393
51395
|
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol);
|
|
51394
51396
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
51395
51397
|
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
51398
|
+
const addUndefined = addUndefinedForParameter || !!(symbol.flags & 4 /* Property */ && symbol.flags & 16777216 /* Optional */ && isOptionalDeclaration(declWithExistingAnnotation) && ((_a = symbol.links) == null ? void 0 : _a.mappedType) && containsNonMissingUndefinedType(type));
|
|
51396
51399
|
const result2 = !isTypePredicateNode(existing) && tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
51397
51400
|
if (result2) {
|
|
51398
51401
|
context.flags = oldFlags;
|
|
@@ -51403,9 +51406,9 @@ function createTypeChecker(host) {
|
|
|
51403
51406
|
if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
|
|
51404
51407
|
context.flags |= 1048576 /* AllowUniqueESSymbolType */;
|
|
51405
51408
|
}
|
|
51406
|
-
const decl = declaration ?? symbol.valueDeclaration ?? ((
|
|
51409
|
+
const decl = declaration ?? symbol.valueDeclaration ?? ((_b = symbol.declarations) == null ? void 0 : _b[0]);
|
|
51407
51410
|
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
|
|
51408
|
-
const result = expressionOrTypeToTypeNode(context, expr, type,
|
|
51411
|
+
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefinedForParameter);
|
|
51409
51412
|
context.flags = oldFlags;
|
|
51410
51413
|
return result;
|
|
51411
51414
|
}
|
|
@@ -51440,9 +51443,9 @@ function createTypeChecker(host) {
|
|
|
51440
51443
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
51441
51444
|
const type = getReturnTypeOfSignature(signature);
|
|
51442
51445
|
if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
51443
|
-
const annotation =
|
|
51444
|
-
if (annotation
|
|
51445
|
-
const result =
|
|
51446
|
+
const annotation = getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
|
|
51447
|
+
if (annotation) {
|
|
51448
|
+
const result = tryReuseExistingTypeNode(context, annotation, type, context.enclosingDeclaration);
|
|
51446
51449
|
if (result) {
|
|
51447
51450
|
return result;
|
|
51448
51451
|
}
|
|
@@ -51936,7 +51939,10 @@ function createTypeChecker(host) {
|
|
|
51936
51939
|
);
|
|
51937
51940
|
}
|
|
51938
51941
|
if (isNamedDeclaration(node) && node.name.kind === 167 /* ComputedPropertyName */ && !isLateBindableName(node.name)) {
|
|
51939
|
-
if (!
|
|
51942
|
+
if (!hasDynamicName(node)) {
|
|
51943
|
+
return visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
51944
|
+
}
|
|
51945
|
+
if (!(context.flags & 1 /* AllowUnresolvedNames */ && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
|
|
51940
51946
|
return void 0;
|
|
51941
51947
|
}
|
|
51942
51948
|
}
|
|
@@ -58027,7 +58033,7 @@ function createTypeChecker(host) {
|
|
|
58027
58033
|
);
|
|
58028
58034
|
}
|
|
58029
58035
|
function createSignatureTypeMapper(signature, typeArguments) {
|
|
58030
|
-
return createTypeMapper(signature.typeParameters, typeArguments);
|
|
58036
|
+
return createTypeMapper(sameMap(signature.typeParameters, (tp) => tp.mapper ? instantiateType(tp, tp.mapper) : tp), typeArguments);
|
|
58031
58037
|
}
|
|
58032
58038
|
function getErasedSignature(signature) {
|
|
58033
58039
|
return signature.typeParameters ? signature.erasedSignatureCache || (signature.erasedSignatureCache = createErasedSignature(signature)) : signature;
|
|
@@ -62683,6 +62689,10 @@ function createTypeChecker(host) {
|
|
|
62683
62689
|
function containsUndefinedType(type) {
|
|
62684
62690
|
return !!((type.flags & 1048576 /* Union */ ? type.types[0] : type).flags & 32768 /* Undefined */);
|
|
62685
62691
|
}
|
|
62692
|
+
function containsNonMissingUndefinedType(type) {
|
|
62693
|
+
const candidate = type.flags & 1048576 /* Union */ ? type.types[0] : type;
|
|
62694
|
+
return !!(candidate.flags & 32768 /* Undefined */) && candidate !== missingType;
|
|
62695
|
+
}
|
|
62686
62696
|
function isStringIndexSignatureOnlyType(type) {
|
|
62687
62697
|
return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) || type.flags & 3145728 /* UnionOrIntersection */ && every(type.types, isStringIndexSignatureOnlyType) || false;
|
|
62688
62698
|
}
|
|
@@ -110992,6 +111002,7 @@ function transformDeclarations(context) {
|
|
|
110992
111002
|
}
|
|
110993
111003
|
function reportInferenceFallback(node) {
|
|
110994
111004
|
if (!isolatedDeclarations || isSourceFileJS(currentSourceFile)) return;
|
|
111005
|
+
if (getSourceFileOfNode(node) !== currentSourceFile) return;
|
|
110995
111006
|
if (isVariableDeclaration(node) && resolver.isExpandoFunctionDeclaration(node)) {
|
|
110996
111007
|
reportExpandoFunctionErrors(node);
|
|
110997
111008
|
} else {
|
package/lib/typescript.js
CHANGED
|
@@ -2251,7 +2251,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2251
2251
|
|
|
2252
2252
|
// src/compiler/corePublic.ts
|
|
2253
2253
|
var versionMajorMinor = "5.6";
|
|
2254
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2254
|
+
var version = `${versionMajorMinor}.0-dev.20240711`;
|
|
2255
2255
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2256
2256
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2257
2257
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6028,6 +6028,7 @@ var TokenFlags = /* @__PURE__ */ ((TokenFlags2) => {
|
|
|
6028
6028
|
TokenFlags2[TokenFlags2["HexEscape"] = 4096] = "HexEscape";
|
|
6029
6029
|
TokenFlags2[TokenFlags2["ContainsLeadingZero"] = 8192] = "ContainsLeadingZero";
|
|
6030
6030
|
TokenFlags2[TokenFlags2["ContainsInvalidSeparator"] = 16384] = "ContainsInvalidSeparator";
|
|
6031
|
+
TokenFlags2[TokenFlags2["PrecedingJSDocLeadingAsterisks"] = 32768] = "PrecedingJSDocLeadingAsterisks";
|
|
6031
6032
|
TokenFlags2[TokenFlags2["BinaryOrOctalSpecifier"] = 384] = "BinaryOrOctalSpecifier";
|
|
6032
6033
|
TokenFlags2[TokenFlags2["WithSpecifier"] = 448] = "WithSpecifier";
|
|
6033
6034
|
TokenFlags2[TokenFlags2["StringLiteralFlags"] = 7176] = "StringLiteralFlags";
|
|
@@ -11953,6 +11954,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
11953
11954
|
hasExtendedUnicodeEscape: () => (tokenFlags & 8 /* ExtendedUnicodeEscape */) !== 0,
|
|
11954
11955
|
hasPrecedingLineBreak: () => (tokenFlags & 1 /* PrecedingLineBreak */) !== 0,
|
|
11955
11956
|
hasPrecedingJSDocComment: () => (tokenFlags & 2 /* PrecedingJSDocComment */) !== 0,
|
|
11957
|
+
hasPrecedingJSDocLeadingAsterisks: () => (tokenFlags & 32768 /* PrecedingJSDocLeadingAsterisks */) !== 0,
|
|
11956
11958
|
isIdentifier: () => token === 80 /* Identifier */ || token > 118 /* LastReservedWord */,
|
|
11957
11959
|
isReservedWord: () => token >= 83 /* FirstReservedWord */ && token <= 118 /* LastReservedWord */,
|
|
11958
11960
|
isUnterminated: () => (tokenFlags & 4 /* Unterminated */) !== 0,
|
|
@@ -12593,7 +12595,6 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12593
12595
|
function scan() {
|
|
12594
12596
|
fullStartPos = pos;
|
|
12595
12597
|
tokenFlags = 0 /* None */;
|
|
12596
|
-
let asteriskSeen = false;
|
|
12597
12598
|
while (true) {
|
|
12598
12599
|
tokenStart = pos;
|
|
12599
12600
|
if (pos >= end) {
|
|
@@ -12709,8 +12710,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12709
12710
|
return pos += 2, token = 43 /* AsteriskAsteriskToken */;
|
|
12710
12711
|
}
|
|
12711
12712
|
pos++;
|
|
12712
|
-
if (skipJsDocLeadingAsterisks &&
|
|
12713
|
-
|
|
12713
|
+
if (skipJsDocLeadingAsterisks && (tokenFlags & 32768 /* PrecedingJSDocLeadingAsterisks */) === 0 && tokenFlags & 1 /* PrecedingLineBreak */) {
|
|
12714
|
+
tokenFlags |= 32768 /* PrecedingJSDocLeadingAsterisks */;
|
|
12714
12715
|
continue;
|
|
12715
12716
|
}
|
|
12716
12717
|
return token = 42 /* AsteriskToken */;
|
|
@@ -33200,7 +33201,7 @@ var Parser;
|
|
|
33200
33201
|
function createIdentifier(isIdentifier3, diagnosticMessage, privateIdentifierDiagnosticMessage) {
|
|
33201
33202
|
if (isIdentifier3) {
|
|
33202
33203
|
identifierCount++;
|
|
33203
|
-
const pos = getNodePos();
|
|
33204
|
+
const pos = scanner2.hasPrecedingJSDocLeadingAsterisks() ? scanner2.getTokenStart() : getNodePos();
|
|
33204
33205
|
const originalKeywordKind = token();
|
|
33205
33206
|
const text = internIdentifier(scanner2.getTokenValue());
|
|
33206
33207
|
const hasExtendedUnicodeEscape = scanner2.hasExtendedUnicodeEscape();
|
|
@@ -40330,6 +40331,7 @@ var commandOptionsWithoutBuild = [
|
|
|
40330
40331
|
type: "boolean",
|
|
40331
40332
|
affectsEmit: true,
|
|
40332
40333
|
affectsBuildInfo: true,
|
|
40334
|
+
affectsSourceFile: true,
|
|
40333
40335
|
category: Diagnostics.Emit,
|
|
40334
40336
|
description: Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
|
|
40335
40337
|
defaultValueDescription: false
|
|
@@ -40794,6 +40796,7 @@ var commandOptionsWithoutBuild = [
|
|
|
40794
40796
|
affectsEmit: true,
|
|
40795
40797
|
affectsBuildInfo: true,
|
|
40796
40798
|
affectsModuleResolution: true,
|
|
40799
|
+
affectsSourceFile: true,
|
|
40797
40800
|
category: Diagnostics.Language_and_Environment,
|
|
40798
40801
|
description: Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
|
|
40799
40802
|
defaultValueDescription: "react"
|
|
@@ -54031,11 +54034,11 @@ function createTypeChecker(host) {
|
|
|
54031
54034
|
function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined) {
|
|
54032
54035
|
const originalType = type;
|
|
54033
54036
|
if (addUndefined) {
|
|
54034
|
-
type = getOptionalType(type);
|
|
54037
|
+
type = getOptionalType(type, !isParameter(host2));
|
|
54035
54038
|
}
|
|
54036
54039
|
const clone2 = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2);
|
|
54037
54040
|
if (clone2) {
|
|
54038
|
-
if (addUndefined && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
|
|
54041
|
+
if (addUndefined && containsNonMissingUndefinedType(type) && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
|
|
54039
54042
|
return factory.createUnionTypeNode([clone2, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
54040
54043
|
}
|
|
54041
54044
|
return clone2;
|
|
@@ -55982,8 +55985,8 @@ function createTypeChecker(host) {
|
|
|
55982
55985
|
return enclosingDeclaration;
|
|
55983
55986
|
}
|
|
55984
55987
|
function serializeTypeForDeclaration(context, declaration, type, symbol) {
|
|
55985
|
-
var _a;
|
|
55986
|
-
const
|
|
55988
|
+
var _a, _b;
|
|
55989
|
+
const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
55987
55990
|
const enclosingDeclaration = context.enclosingDeclaration;
|
|
55988
55991
|
const oldFlags = context.flags;
|
|
55989
55992
|
if (declaration && hasInferredType(declaration) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
|
|
@@ -55994,6 +55997,7 @@ function createTypeChecker(host) {
|
|
|
55994
55997
|
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol);
|
|
55995
55998
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
55996
55999
|
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
56000
|
+
const addUndefined = addUndefinedForParameter || !!(symbol.flags & 4 /* Property */ && symbol.flags & 16777216 /* Optional */ && isOptionalDeclaration(declWithExistingAnnotation) && ((_a = symbol.links) == null ? void 0 : _a.mappedType) && containsNonMissingUndefinedType(type));
|
|
55997
56001
|
const result2 = !isTypePredicateNode(existing) && tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
55998
56002
|
if (result2) {
|
|
55999
56003
|
context.flags = oldFlags;
|
|
@@ -56004,9 +56008,9 @@ function createTypeChecker(host) {
|
|
|
56004
56008
|
if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
|
|
56005
56009
|
context.flags |= 1048576 /* AllowUniqueESSymbolType */;
|
|
56006
56010
|
}
|
|
56007
|
-
const decl = declaration ?? symbol.valueDeclaration ?? ((
|
|
56011
|
+
const decl = declaration ?? symbol.valueDeclaration ?? ((_b = symbol.declarations) == null ? void 0 : _b[0]);
|
|
56008
56012
|
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
|
|
56009
|
-
const result = expressionOrTypeToTypeNode(context, expr, type,
|
|
56013
|
+
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefinedForParameter);
|
|
56010
56014
|
context.flags = oldFlags;
|
|
56011
56015
|
return result;
|
|
56012
56016
|
}
|
|
@@ -56041,9 +56045,9 @@ function createTypeChecker(host) {
|
|
|
56041
56045
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
56042
56046
|
const type = getReturnTypeOfSignature(signature);
|
|
56043
56047
|
if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
56044
|
-
const annotation =
|
|
56045
|
-
if (annotation
|
|
56046
|
-
const result =
|
|
56048
|
+
const annotation = getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
|
|
56049
|
+
if (annotation) {
|
|
56050
|
+
const result = tryReuseExistingTypeNode(context, annotation, type, context.enclosingDeclaration);
|
|
56047
56051
|
if (result) {
|
|
56048
56052
|
return result;
|
|
56049
56053
|
}
|
|
@@ -56537,7 +56541,10 @@ function createTypeChecker(host) {
|
|
|
56537
56541
|
);
|
|
56538
56542
|
}
|
|
56539
56543
|
if (isNamedDeclaration(node) && node.name.kind === 167 /* ComputedPropertyName */ && !isLateBindableName(node.name)) {
|
|
56540
|
-
if (!
|
|
56544
|
+
if (!hasDynamicName(node)) {
|
|
56545
|
+
return visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
56546
|
+
}
|
|
56547
|
+
if (!(context.flags & 1 /* AllowUnresolvedNames */ && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
|
|
56541
56548
|
return void 0;
|
|
56542
56549
|
}
|
|
56543
56550
|
}
|
|
@@ -62628,7 +62635,7 @@ function createTypeChecker(host) {
|
|
|
62628
62635
|
);
|
|
62629
62636
|
}
|
|
62630
62637
|
function createSignatureTypeMapper(signature, typeArguments) {
|
|
62631
|
-
return createTypeMapper(signature.typeParameters, typeArguments);
|
|
62638
|
+
return createTypeMapper(sameMap(signature.typeParameters, (tp) => tp.mapper ? instantiateType(tp, tp.mapper) : tp), typeArguments);
|
|
62632
62639
|
}
|
|
62633
62640
|
function getErasedSignature(signature) {
|
|
62634
62641
|
return signature.typeParameters ? signature.erasedSignatureCache || (signature.erasedSignatureCache = createErasedSignature(signature)) : signature;
|
|
@@ -67284,6 +67291,10 @@ function createTypeChecker(host) {
|
|
|
67284
67291
|
function containsUndefinedType(type) {
|
|
67285
67292
|
return !!((type.flags & 1048576 /* Union */ ? type.types[0] : type).flags & 32768 /* Undefined */);
|
|
67286
67293
|
}
|
|
67294
|
+
function containsNonMissingUndefinedType(type) {
|
|
67295
|
+
const candidate = type.flags & 1048576 /* Union */ ? type.types[0] : type;
|
|
67296
|
+
return !!(candidate.flags & 32768 /* Undefined */) && candidate !== missingType;
|
|
67297
|
+
}
|
|
67287
67298
|
function isStringIndexSignatureOnlyType(type) {
|
|
67288
67299
|
return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) || type.flags & 3145728 /* UnionOrIntersection */ && every(type.types, isStringIndexSignatureOnlyType) || false;
|
|
67289
67300
|
}
|
|
@@ -115775,6 +115786,7 @@ function transformDeclarations(context) {
|
|
|
115775
115786
|
}
|
|
115776
115787
|
function reportInferenceFallback(node) {
|
|
115777
115788
|
if (!isolatedDeclarations || isSourceFileJS(currentSourceFile)) return;
|
|
115789
|
+
if (getSourceFileOfNode(node) !== currentSourceFile) return;
|
|
115778
115790
|
if (isVariableDeclaration(node) && resolver.isExpandoFunctionDeclaration(node)) {
|
|
115779
115791
|
reportExpandoFunctionErrors(node);
|
|
115780
115792
|
} else {
|
|
@@ -138875,6 +138887,7 @@ function isImportableSymbol(symbol, checker) {
|
|
|
138875
138887
|
function forEachNameOfDefaultExport(defaultExport, checker, compilerOptions, preferCapitalizedNames, cb) {
|
|
138876
138888
|
let chain;
|
|
138877
138889
|
let current = defaultExport;
|
|
138890
|
+
const seen = /* @__PURE__ */ new Map();
|
|
138878
138891
|
while (current) {
|
|
138879
138892
|
const fromDeclaration = getDefaultLikeExportNameFromDeclaration(current);
|
|
138880
138893
|
if (fromDeclaration) {
|
|
@@ -138886,6 +138899,7 @@ function forEachNameOfDefaultExport(defaultExport, checker, compilerOptions, pre
|
|
|
138886
138899
|
if (final) return final;
|
|
138887
138900
|
}
|
|
138888
138901
|
chain = append(chain, current);
|
|
138902
|
+
if (!addToSeen(seen, current)) break;
|
|
138889
138903
|
current = current.flags & 2097152 /* Alias */ ? checker.getImmediateAliasedSymbol(current) : void 0;
|
|
138890
138904
|
}
|
|
138891
138905
|
for (const symbol of chain ?? emptyArray) {
|
|
@@ -167977,7 +167991,7 @@ function getContainingModuleSymbol(importer, checker) {
|
|
|
167977
167991
|
return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol);
|
|
167978
167992
|
}
|
|
167979
167993
|
function getSourceFileLikeForImportDeclaration(node) {
|
|
167980
|
-
if (node.kind === 213 /* CallExpression */) {
|
|
167994
|
+
if (node.kind === 213 /* CallExpression */ || node.kind === 351 /* JSDocImportTag */) {
|
|
167981
167995
|
return node.getSourceFile();
|
|
167982
167996
|
}
|
|
167983
167997
|
const { parent: parent2 } = node;
|
|
@@ -178434,8 +178448,9 @@ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, pr
|
|
|
178434
178448
|
const { pos, end } = pasteLocations[i];
|
|
178435
178449
|
newText = actualPastedText ? newText.slice(0, pos) + actualPastedText[0] + newText.slice(end) : newText.slice(0, pos) + pastedText[i] + newText.slice(end);
|
|
178436
178450
|
}
|
|
178451
|
+
let importAdder;
|
|
178437
178452
|
Debug.checkDefined(host.runWithTemporaryFileUpdate).call(host, targetFile.fileName, newText, (updatedProgram, originalProgram, updatedFile) => {
|
|
178438
|
-
|
|
178453
|
+
importAdder = ts_codefix_exports.createImportAdder(updatedFile, updatedProgram, preferences, host);
|
|
178439
178454
|
if (copiedFrom == null ? void 0 : copiedFrom.range) {
|
|
178440
178455
|
Debug.assert(copiedFrom.range.length === pastedText.length);
|
|
178441
178456
|
copiedFrom.range.forEach((copy) => {
|
|
@@ -178482,6 +178497,9 @@ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, pr
|
|
|
178482
178497
|
}
|
|
178483
178498
|
importAdder.writeFixes(changes, getQuotePreference(copiedFrom ? copiedFrom.file : targetFile, preferences));
|
|
178484
178499
|
});
|
|
178500
|
+
if (!importAdder.hasFixes()) {
|
|
178501
|
+
return;
|
|
178502
|
+
}
|
|
178485
178503
|
pasteLocations.forEach((paste, i) => {
|
|
178486
178504
|
changes.replaceRangeWithText(
|
|
178487
178505
|
targetFile,
|
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.6.0-dev.
|
|
5
|
+
"version": "5.6.0-dev.20240711",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "20.1.0",
|
|
114
114
|
"npm": "8.19.4"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "e450c463c610136ee86392f90025e03071334def"
|
|
117
117
|
}
|