Skip to content

Commit 609560f

Browse files
Bump version to 5.4.3 and LKG
1 parent f42605f commit 609560f

7 files changed

+128
-131
lines changed

lib/tsc.js

+41-42
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ and limitations under the License.
1818

1919
// src/compiler/corePublic.ts
2020
var versionMajorMinor = "5.4";
21-
var version = "5.4.2";
21+
var version = "5.4.3";
2222

2323
// src/compiler/core.ts
2424
var emptyArray = [];
@@ -57966,7 +57966,7 @@ function createTypeChecker(host) {
5796657966
const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
5796757967
const typeVariable = typeSet[typeVarIndex];
5796857968
const primitiveType = typeSet[1 - typeVarIndex];
57969-
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) || includes & 16777216 /* IncludesEmptyObject */)) {
57969+
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) && !isGenericStringLikeType(primitiveType) || includes & 16777216 /* IncludesEmptyObject */)) {
5797057970
const constraint = getBaseConstraintOfType(typeVariable);
5797157971
if (constraint && everyType(constraint, (t) => !!(t.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */)) || isEmptyAnonymousObjectType(t))) {
5797257972
if (isTypeStrictSubtypeOf(constraint, primitiveType)) {
@@ -58574,6 +58574,9 @@ function createTypeChecker(host) {
5857458574
function isPatternLiteralType(type) {
5857558575
return !!(type.flags & 134217728 /* TemplateLiteral */) && every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 268435456 /* StringMapping */) && isPatternLiteralPlaceholderType(type.type);
5857658576
}
58577+
function isGenericStringLikeType(type) {
58578+
return !!(type.flags & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) && !isPatternLiteralType(type);
58579+
}
5857758580
function isGenericType(type) {
5857858581
return !!getGenericObjectFlags(type);
5857958582
}
@@ -58596,7 +58599,7 @@ function createTypeChecker(host) {
5859658599
}
5859758600
return type.objectFlags & 12582912 /* IsGenericType */;
5859858601
}
58599-
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
58602+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */) || isGenericStringLikeType(type) ? 8388608 /* IsGenericIndexType */ : 0);
5860058603
}
5860158604
function getSimplifiedType(type, writing) {
5860258605
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
@@ -65644,7 +65647,7 @@ function createTypeChecker(host) {
6564465647
function hasMatchingArgument(expression, reference) {
6564565648
if (expression.arguments) {
6564665649
for (const argument of expression.arguments) {
65647-
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference) || getCandidateDiscriminantPropertyAccess(argument, reference)) {
65650+
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference)) {
6564865651
return true;
6564965652
}
6565065653
}
@@ -65654,36 +65657,6 @@ function createTypeChecker(host) {
6565465657
}
6565565658
return false;
6565665659
}
65657-
function getCandidateDiscriminantPropertyAccess(expr, reference) {
65658-
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
65659-
if (isIdentifier(expr)) {
65660-
const symbol = getResolvedSymbol(expr);
65661-
const declaration = symbol.valueDeclaration;
65662-
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
65663-
return declaration;
65664-
}
65665-
}
65666-
} else if (isAccessExpression(expr)) {
65667-
if (isMatchingReference(reference, expr.expression)) {
65668-
return expr;
65669-
}
65670-
} else if (isIdentifier(expr)) {
65671-
const symbol = getResolvedSymbol(expr);
65672-
if (isConstantVariable(symbol)) {
65673-
const declaration = symbol.valueDeclaration;
65674-
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
65675-
return declaration.initializer;
65676-
}
65677-
if (isBindingElement(declaration) && !declaration.initializer) {
65678-
const parent = declaration.parent.parent;
65679-
if (isVariableDeclaration(parent) && !parent.type && parent.initializer && (isIdentifier(parent.initializer) || isAccessExpression(parent.initializer)) && isMatchingReference(reference, parent.initializer)) {
65680-
return declaration;
65681-
}
65682-
}
65683-
}
65684-
}
65685-
return void 0;
65686-
}
6568765660
function getFlowNodeId(flow) {
6568865661
if (!flow.id || flow.id < 0) {
6568965662
flow.id = nextFlowId;
@@ -66783,9 +66756,39 @@ function createTypeChecker(host) {
6678366756
}
6678466757
return result;
6678566758
}
66759+
function getCandidateDiscriminantPropertyAccess(expr) {
66760+
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
66761+
if (isIdentifier(expr)) {
66762+
const symbol = getResolvedSymbol(expr);
66763+
const declaration = symbol.valueDeclaration;
66764+
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
66765+
return declaration;
66766+
}
66767+
}
66768+
} else if (isAccessExpression(expr)) {
66769+
if (isMatchingReference(reference, expr.expression)) {
66770+
return expr;
66771+
}
66772+
} else if (isIdentifier(expr)) {
66773+
const symbol = getResolvedSymbol(expr);
66774+
if (isConstantVariable(symbol)) {
66775+
const declaration = symbol.valueDeclaration;
66776+
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
66777+
return declaration.initializer;
66778+
}
66779+
if (isBindingElement(declaration) && !declaration.initializer) {
66780+
const parent = declaration.parent.parent;
66781+
if (isVariableDeclaration(parent) && !parent.type && parent.initializer && (isIdentifier(parent.initializer) || isAccessExpression(parent.initializer)) && isMatchingReference(reference, parent.initializer)) {
66782+
return declaration;
66783+
}
66784+
}
66785+
}
66786+
}
66787+
return void 0;
66788+
}
6678666789
function getDiscriminantPropertyAccess(expr, computedType) {
6678766790
if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
66788-
const access = getCandidateDiscriminantPropertyAccess(expr, reference);
66791+
const access = getCandidateDiscriminantPropertyAccess(expr);
6678966792
if (access) {
6679066793
const name = getAccessedPropertyName(access);
6679166794
if (name) {
@@ -72506,7 +72509,7 @@ function createTypeChecker(host) {
7250672509
}
7250772510
return resolveErrorCall(node);
7250872511
}
72509-
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunctionOrConstructor)) {
72512+
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
7251072513
skippedGenericFunction(node, checkMode);
7251172514
return resolvingSignature;
7251272515
}
@@ -72516,12 +72519,8 @@ function createTypeChecker(host) {
7251672519
}
7251772520
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
7251872521
}
72519-
function isGenericFunctionReturningFunctionOrConstructor(signature) {
72520-
if (!signature.typeParameters) {
72521-
return false;
72522-
}
72523-
const returnType = getReturnTypeOfSignature(signature);
72524-
return isFunctionType(returnType) || isConstructorType(returnType);
72522+
function isGenericFunctionReturningFunction(signature) {
72523+
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
7252572524
}
7252672525
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
7252772526
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144 /* TypeParameter */) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576 /* Union */) && !(getReducedType(apparentFuncType).flags & 131072 /* Never */) && isTypeAssignableTo(funcType, globalFunctionType);

lib/tsserver.js

+41-42
Original file line numberDiff line numberDiff line change
@@ -2340,7 +2340,7 @@ module.exports = __toCommonJS(server_exports);
23402340

23412341
// src/compiler/corePublic.ts
23422342
var versionMajorMinor = "5.4";
2343-
var version = "5.4.2";
2343+
var version = "5.4.3";
23442344
var Comparison = /* @__PURE__ */ ((Comparison3) => {
23452345
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
23462346
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -62710,7 +62710,7 @@ function createTypeChecker(host) {
6271062710
const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
6271162711
const typeVariable = typeSet[typeVarIndex];
6271262712
const primitiveType = typeSet[1 - typeVarIndex];
62713-
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) || includes & 16777216 /* IncludesEmptyObject */)) {
62713+
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) && !isGenericStringLikeType(primitiveType) || includes & 16777216 /* IncludesEmptyObject */)) {
6271462714
const constraint = getBaseConstraintOfType(typeVariable);
6271562715
if (constraint && everyType(constraint, (t) => !!(t.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */)) || isEmptyAnonymousObjectType(t))) {
6271662716
if (isTypeStrictSubtypeOf(constraint, primitiveType)) {
@@ -63318,6 +63318,9 @@ function createTypeChecker(host) {
6331863318
function isPatternLiteralType(type) {
6331963319
return !!(type.flags & 134217728 /* TemplateLiteral */) && every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 268435456 /* StringMapping */) && isPatternLiteralPlaceholderType(type.type);
6332063320
}
63321+
function isGenericStringLikeType(type) {
63322+
return !!(type.flags & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) && !isPatternLiteralType(type);
63323+
}
6332163324
function isGenericType(type) {
6332263325
return !!getGenericObjectFlags(type);
6332363326
}
@@ -63340,7 +63343,7 @@ function createTypeChecker(host) {
6334063343
}
6334163344
return type.objectFlags & 12582912 /* IsGenericType */;
6334263345
}
63343-
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
63346+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */) || isGenericStringLikeType(type) ? 8388608 /* IsGenericIndexType */ : 0);
6334463347
}
6334563348
function getSimplifiedType(type, writing) {
6334663349
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
@@ -70388,7 +70391,7 @@ function createTypeChecker(host) {
7038870391
function hasMatchingArgument(expression, reference) {
7038970392
if (expression.arguments) {
7039070393
for (const argument of expression.arguments) {
70391-
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference) || getCandidateDiscriminantPropertyAccess(argument, reference)) {
70394+
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference)) {
7039270395
return true;
7039370396
}
7039470397
}
@@ -70398,36 +70401,6 @@ function createTypeChecker(host) {
7039870401
}
7039970402
return false;
7040070403
}
70401-
function getCandidateDiscriminantPropertyAccess(expr, reference) {
70402-
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
70403-
if (isIdentifier(expr)) {
70404-
const symbol = getResolvedSymbol(expr);
70405-
const declaration = symbol.valueDeclaration;
70406-
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
70407-
return declaration;
70408-
}
70409-
}
70410-
} else if (isAccessExpression(expr)) {
70411-
if (isMatchingReference(reference, expr.expression)) {
70412-
return expr;
70413-
}
70414-
} else if (isIdentifier(expr)) {
70415-
const symbol = getResolvedSymbol(expr);
70416-
if (isConstantVariable(symbol)) {
70417-
const declaration = symbol.valueDeclaration;
70418-
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
70419-
return declaration.initializer;
70420-
}
70421-
if (isBindingElement(declaration) && !declaration.initializer) {
70422-
const parent2 = declaration.parent.parent;
70423-
if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) {
70424-
return declaration;
70425-
}
70426-
}
70427-
}
70428-
}
70429-
return void 0;
70430-
}
7043170404
function getFlowNodeId(flow) {
7043270405
if (!flow.id || flow.id < 0) {
7043370406
flow.id = nextFlowId;
@@ -71527,9 +71500,39 @@ function createTypeChecker(host) {
7152771500
}
7152871501
return result;
7152971502
}
71503+
function getCandidateDiscriminantPropertyAccess(expr) {
71504+
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
71505+
if (isIdentifier(expr)) {
71506+
const symbol = getResolvedSymbol(expr);
71507+
const declaration = symbol.valueDeclaration;
71508+
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
71509+
return declaration;
71510+
}
71511+
}
71512+
} else if (isAccessExpression(expr)) {
71513+
if (isMatchingReference(reference, expr.expression)) {
71514+
return expr;
71515+
}
71516+
} else if (isIdentifier(expr)) {
71517+
const symbol = getResolvedSymbol(expr);
71518+
if (isConstantVariable(symbol)) {
71519+
const declaration = symbol.valueDeclaration;
71520+
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
71521+
return declaration.initializer;
71522+
}
71523+
if (isBindingElement(declaration) && !declaration.initializer) {
71524+
const parent2 = declaration.parent.parent;
71525+
if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) {
71526+
return declaration;
71527+
}
71528+
}
71529+
}
71530+
}
71531+
return void 0;
71532+
}
7153071533
function getDiscriminantPropertyAccess(expr, computedType) {
7153171534
if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
71532-
const access = getCandidateDiscriminantPropertyAccess(expr, reference);
71535+
const access = getCandidateDiscriminantPropertyAccess(expr);
7153371536
if (access) {
7153471537
const name = getAccessedPropertyName(access);
7153571538
if (name) {
@@ -77250,7 +77253,7 @@ function createTypeChecker(host) {
7725077253
}
7725177254
return resolveErrorCall(node);
7725277255
}
77253-
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunctionOrConstructor)) {
77256+
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
7725477257
skippedGenericFunction(node, checkMode);
7725577258
return resolvingSignature;
7725677259
}
@@ -77260,12 +77263,8 @@ function createTypeChecker(host) {
7726077263
}
7726177264
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
7726277265
}
77263-
function isGenericFunctionReturningFunctionOrConstructor(signature) {
77264-
if (!signature.typeParameters) {
77265-
return false;
77266-
}
77267-
const returnType = getReturnTypeOfSignature(signature);
77268-
return isFunctionType(returnType) || isConstructorType(returnType);
77266+
function isGenericFunctionReturningFunction(signature) {
77267+
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
7726977268
}
7727077269
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
7727177270
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144 /* TypeParameter */) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576 /* Union */) && !(getReducedType(apparentFuncType).flags & 131072 /* Never */) && isTypeAssignableTo(funcType, globalFunctionType);

0 commit comments

Comments
 (0)