typescript 5.4.1-rc → 5.4.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 +65 -71
- package/lib/tsserver.js +65 -71
- package/lib/typescript.js +65 -71
- package/lib/typingsInstaller.js +1 -1
- package/package.json +1 -1
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.4";
|
|
21
|
-
var version = "5.4.
|
|
21
|
+
var version = "5.4.3";
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -47517,13 +47517,6 @@ function createTypeChecker(host) {
|
|
|
47517
47517
|
});
|
|
47518
47518
|
}
|
|
47519
47519
|
function getSymbolIfSameReference(s1, s2) {
|
|
47520
|
-
var _a, _b;
|
|
47521
|
-
if (s1.flags & 524288 /* TypeAlias */ && ((_a = s2.declarations) == null ? void 0 : _a.find(isTypeAlias))) {
|
|
47522
|
-
s2 = getDeclaredTypeOfTypeAlias(s2).aliasSymbol || s2;
|
|
47523
|
-
}
|
|
47524
|
-
if (s2.flags & 524288 /* TypeAlias */ && ((_b = s1.declarations) == null ? void 0 : _b.find(isTypeAlias))) {
|
|
47525
|
-
s1 = getDeclaredTypeOfTypeAlias(s1).aliasSymbol || s1;
|
|
47526
|
-
}
|
|
47527
47520
|
if (getMergedSymbol(resolveSymbol(getMergedSymbol(s1))) === getMergedSymbol(resolveSymbol(getMergedSymbol(s2)))) {
|
|
47528
47521
|
return s1;
|
|
47529
47522
|
}
|
|
@@ -55321,13 +55314,16 @@ function createTypeChecker(host) {
|
|
|
55321
55314
|
const constraint = getConstraintTypeFromMappedType(type);
|
|
55322
55315
|
if (constraint.flags & 4194304 /* Index */) {
|
|
55323
55316
|
const baseConstraint = getBaseConstraintOfType(constraint.type);
|
|
55324
|
-
if (baseConstraint && everyType(baseConstraint, isArrayOrTupleType)) {
|
|
55317
|
+
if (baseConstraint && everyType(baseConstraint, (t) => isArrayOrTupleType(t) || isArrayOrTupleOrIntersection(t))) {
|
|
55325
55318
|
return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
|
|
55326
55319
|
}
|
|
55327
55320
|
}
|
|
55328
55321
|
}
|
|
55329
55322
|
return type;
|
|
55330
55323
|
}
|
|
55324
|
+
function isArrayOrTupleOrIntersection(type) {
|
|
55325
|
+
return !!(type.flags & 2097152 /* Intersection */) && every(type.types, isArrayOrTupleType);
|
|
55326
|
+
}
|
|
55331
55327
|
function isMappedTypeGenericIndexedAccess(type) {
|
|
55332
55328
|
let objectType;
|
|
55333
55329
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
@@ -57966,7 +57962,7 @@ function createTypeChecker(host) {
|
|
|
57966
57962
|
const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
57967
57963
|
const typeVariable = typeSet[typeVarIndex];
|
|
57968
57964
|
const primitiveType = typeSet[1 - typeVarIndex];
|
|
57969
|
-
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) || includes & 16777216 /* IncludesEmptyObject */)) {
|
|
57965
|
+
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) && !isGenericStringLikeType(primitiveType) || includes & 16777216 /* IncludesEmptyObject */)) {
|
|
57970
57966
|
const constraint = getBaseConstraintOfType(typeVariable);
|
|
57971
57967
|
if (constraint && everyType(constraint, (t) => !!(t.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */)) || isEmptyAnonymousObjectType(t))) {
|
|
57972
57968
|
if (isTypeStrictSubtypeOf(constraint, primitiveType)) {
|
|
@@ -58574,6 +58570,9 @@ function createTypeChecker(host) {
|
|
|
58574
58570
|
function isPatternLiteralType(type) {
|
|
58575
58571
|
return !!(type.flags & 134217728 /* TemplateLiteral */) && every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 268435456 /* StringMapping */) && isPatternLiteralPlaceholderType(type.type);
|
|
58576
58572
|
}
|
|
58573
|
+
function isGenericStringLikeType(type) {
|
|
58574
|
+
return !!(type.flags & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) && !isPatternLiteralType(type);
|
|
58575
|
+
}
|
|
58577
58576
|
function isGenericType(type) {
|
|
58578
58577
|
return !!getGenericObjectFlags(type);
|
|
58579
58578
|
}
|
|
@@ -58596,7 +58595,7 @@ function createTypeChecker(host) {
|
|
|
58596
58595
|
}
|
|
58597
58596
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
58598
58597
|
}
|
|
58599
|
-
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */
|
|
58598
|
+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */) || isGenericStringLikeType(type) ? 8388608 /* IsGenericIndexType */ : 0);
|
|
58600
58599
|
}
|
|
58601
58600
|
function getSimplifiedType(type, writing) {
|
|
58602
58601
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -59695,29 +59694,28 @@ function createTypeChecker(host) {
|
|
|
59695
59694
|
if (typeVariable) {
|
|
59696
59695
|
const mappedTypeVariable = instantiateType(typeVariable, mapper);
|
|
59697
59696
|
if (typeVariable !== mappedTypeVariable) {
|
|
59698
|
-
return mapTypeWithAlias(
|
|
59699
|
-
getReducedType(mappedTypeVariable),
|
|
59700
|
-
(t) => {
|
|
59701
|
-
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
59702
|
-
if (!type.declaration.nameType) {
|
|
59703
|
-
let constraint;
|
|
59704
|
-
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
59705
|
-
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
59706
|
-
}
|
|
59707
|
-
if (isTupleType(t)) {
|
|
59708
|
-
return instantiateMappedTupleType(t, type, typeVariable, mapper);
|
|
59709
|
-
}
|
|
59710
|
-
}
|
|
59711
|
-
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
|
|
59712
|
-
}
|
|
59713
|
-
return t;
|
|
59714
|
-
},
|
|
59715
|
-
aliasSymbol,
|
|
59716
|
-
aliasTypeArguments
|
|
59717
|
-
);
|
|
59697
|
+
return mapTypeWithAlias(getReducedType(mappedTypeVariable), instantiateConstituent, aliasSymbol, aliasTypeArguments);
|
|
59718
59698
|
}
|
|
59719
59699
|
}
|
|
59720
59700
|
return instantiateType(getConstraintTypeFromMappedType(type), mapper) === wildcardType ? wildcardType : instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments);
|
|
59701
|
+
function instantiateConstituent(t) {
|
|
59702
|
+
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
59703
|
+
if (!type.declaration.nameType) {
|
|
59704
|
+
let constraint;
|
|
59705
|
+
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
59706
|
+
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
59707
|
+
}
|
|
59708
|
+
if (isTupleType(t)) {
|
|
59709
|
+
return instantiateMappedTupleType(t, type, typeVariable, mapper);
|
|
59710
|
+
}
|
|
59711
|
+
if (isArrayOrTupleOrIntersection(t)) {
|
|
59712
|
+
return getIntersectionType(map(t.types, instantiateConstituent));
|
|
59713
|
+
}
|
|
59714
|
+
}
|
|
59715
|
+
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
|
|
59716
|
+
}
|
|
59717
|
+
return t;
|
|
59718
|
+
}
|
|
59721
59719
|
}
|
|
59722
59720
|
function getModifiedReadonlyState(state, modifiers) {
|
|
59723
59721
|
return modifiers & 1 /* IncludeReadonly */ ? true : modifiers & 2 /* ExcludeReadonly */ ? false : state;
|
|
@@ -65644,7 +65642,7 @@ function createTypeChecker(host) {
|
|
|
65644
65642
|
function hasMatchingArgument(expression, reference) {
|
|
65645
65643
|
if (expression.arguments) {
|
|
65646
65644
|
for (const argument of expression.arguments) {
|
|
65647
|
-
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference)
|
|
65645
|
+
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference)) {
|
|
65648
65646
|
return true;
|
|
65649
65647
|
}
|
|
65650
65648
|
}
|
|
@@ -65654,36 +65652,6 @@ function createTypeChecker(host) {
|
|
|
65654
65652
|
}
|
|
65655
65653
|
return false;
|
|
65656
65654
|
}
|
|
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
|
-
}
|
|
65687
65655
|
function getFlowNodeId(flow) {
|
|
65688
65656
|
if (!flow.id || flow.id < 0) {
|
|
65689
65657
|
flow.id = nextFlowId;
|
|
@@ -66783,9 +66751,39 @@ function createTypeChecker(host) {
|
|
|
66783
66751
|
}
|
|
66784
66752
|
return result;
|
|
66785
66753
|
}
|
|
66754
|
+
function getCandidateDiscriminantPropertyAccess(expr) {
|
|
66755
|
+
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
|
|
66756
|
+
if (isIdentifier(expr)) {
|
|
66757
|
+
const symbol = getResolvedSymbol(expr);
|
|
66758
|
+
const declaration = symbol.valueDeclaration;
|
|
66759
|
+
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
66760
|
+
return declaration;
|
|
66761
|
+
}
|
|
66762
|
+
}
|
|
66763
|
+
} else if (isAccessExpression(expr)) {
|
|
66764
|
+
if (isMatchingReference(reference, expr.expression)) {
|
|
66765
|
+
return expr;
|
|
66766
|
+
}
|
|
66767
|
+
} else if (isIdentifier(expr)) {
|
|
66768
|
+
const symbol = getResolvedSymbol(expr);
|
|
66769
|
+
if (isConstantVariable(symbol)) {
|
|
66770
|
+
const declaration = symbol.valueDeclaration;
|
|
66771
|
+
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
|
|
66772
|
+
return declaration.initializer;
|
|
66773
|
+
}
|
|
66774
|
+
if (isBindingElement(declaration) && !declaration.initializer) {
|
|
66775
|
+
const parent = declaration.parent.parent;
|
|
66776
|
+
if (isVariableDeclaration(parent) && !parent.type && parent.initializer && (isIdentifier(parent.initializer) || isAccessExpression(parent.initializer)) && isMatchingReference(reference, parent.initializer)) {
|
|
66777
|
+
return declaration;
|
|
66778
|
+
}
|
|
66779
|
+
}
|
|
66780
|
+
}
|
|
66781
|
+
}
|
|
66782
|
+
return void 0;
|
|
66783
|
+
}
|
|
66786
66784
|
function getDiscriminantPropertyAccess(expr, computedType) {
|
|
66787
66785
|
if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
|
|
66788
|
-
const access = getCandidateDiscriminantPropertyAccess(expr
|
|
66786
|
+
const access = getCandidateDiscriminantPropertyAccess(expr);
|
|
66789
66787
|
if (access) {
|
|
66790
66788
|
const name = getAccessedPropertyName(access);
|
|
66791
66789
|
if (name) {
|
|
@@ -72506,7 +72504,7 @@ function createTypeChecker(host) {
|
|
|
72506
72504
|
}
|
|
72507
72505
|
return resolveErrorCall(node);
|
|
72508
72506
|
}
|
|
72509
|
-
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(
|
|
72507
|
+
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
|
|
72510
72508
|
skippedGenericFunction(node, checkMode);
|
|
72511
72509
|
return resolvingSignature;
|
|
72512
72510
|
}
|
|
@@ -72516,12 +72514,8 @@ function createTypeChecker(host) {
|
|
|
72516
72514
|
}
|
|
72517
72515
|
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
72518
72516
|
}
|
|
72519
|
-
function
|
|
72520
|
-
|
|
72521
|
-
return false;
|
|
72522
|
-
}
|
|
72523
|
-
const returnType = getReturnTypeOfSignature(signature);
|
|
72524
|
-
return isFunctionType(returnType) || isConstructorType(returnType);
|
|
72517
|
+
function isGenericFunctionReturningFunction(signature) {
|
|
72518
|
+
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
|
|
72525
72519
|
}
|
|
72526
72520
|
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
|
|
72527
72521
|
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144 /* TypeParameter */) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576 /* Union */) && !(getReducedType(apparentFuncType).flags & 131072 /* Never */) && isTypeAssignableTo(funcType, globalFunctionType);
|
|
@@ -80678,7 +80672,7 @@ function createTypeChecker(host) {
|
|
|
80678
80672
|
error(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
|
|
80679
80673
|
} else {
|
|
80680
80674
|
const text = getTextOfPropertyName(member.name);
|
|
80681
|
-
if (isNumericLiteralName(text)) {
|
|
80675
|
+
if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {
|
|
80682
80676
|
error(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name);
|
|
80683
80677
|
}
|
|
80684
80678
|
}
|
package/lib/tsserver.js
CHANGED
|
@@ -2340,7 +2340,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2340
2340
|
|
|
2341
2341
|
// src/compiler/corePublic.ts
|
|
2342
2342
|
var versionMajorMinor = "5.4";
|
|
2343
|
-
var version = "5.4.
|
|
2343
|
+
var version = "5.4.3";
|
|
2344
2344
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2345
2345
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2346
2346
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -52261,13 +52261,6 @@ function createTypeChecker(host) {
|
|
|
52261
52261
|
});
|
|
52262
52262
|
}
|
|
52263
52263
|
function getSymbolIfSameReference(s1, s2) {
|
|
52264
|
-
var _a, _b;
|
|
52265
|
-
if (s1.flags & 524288 /* TypeAlias */ && ((_a = s2.declarations) == null ? void 0 : _a.find(isTypeAlias))) {
|
|
52266
|
-
s2 = getDeclaredTypeOfTypeAlias(s2).aliasSymbol || s2;
|
|
52267
|
-
}
|
|
52268
|
-
if (s2.flags & 524288 /* TypeAlias */ && ((_b = s1.declarations) == null ? void 0 : _b.find(isTypeAlias))) {
|
|
52269
|
-
s1 = getDeclaredTypeOfTypeAlias(s1).aliasSymbol || s1;
|
|
52270
|
-
}
|
|
52271
52264
|
if (getMergedSymbol(resolveSymbol(getMergedSymbol(s1))) === getMergedSymbol(resolveSymbol(getMergedSymbol(s2)))) {
|
|
52272
52265
|
return s1;
|
|
52273
52266
|
}
|
|
@@ -60065,13 +60058,16 @@ function createTypeChecker(host) {
|
|
|
60065
60058
|
const constraint = getConstraintTypeFromMappedType(type);
|
|
60066
60059
|
if (constraint.flags & 4194304 /* Index */) {
|
|
60067
60060
|
const baseConstraint = getBaseConstraintOfType(constraint.type);
|
|
60068
|
-
if (baseConstraint && everyType(baseConstraint, isArrayOrTupleType)) {
|
|
60061
|
+
if (baseConstraint && everyType(baseConstraint, (t) => isArrayOrTupleType(t) || isArrayOrTupleOrIntersection(t))) {
|
|
60069
60062
|
return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
|
|
60070
60063
|
}
|
|
60071
60064
|
}
|
|
60072
60065
|
}
|
|
60073
60066
|
return type;
|
|
60074
60067
|
}
|
|
60068
|
+
function isArrayOrTupleOrIntersection(type) {
|
|
60069
|
+
return !!(type.flags & 2097152 /* Intersection */) && every(type.types, isArrayOrTupleType);
|
|
60070
|
+
}
|
|
60075
60071
|
function isMappedTypeGenericIndexedAccess(type) {
|
|
60076
60072
|
let objectType;
|
|
60077
60073
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
@@ -62710,7 +62706,7 @@ function createTypeChecker(host) {
|
|
|
62710
62706
|
const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
62711
62707
|
const typeVariable = typeSet[typeVarIndex];
|
|
62712
62708
|
const primitiveType = typeSet[1 - typeVarIndex];
|
|
62713
|
-
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) || includes & 16777216 /* IncludesEmptyObject */)) {
|
|
62709
|
+
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) && !isGenericStringLikeType(primitiveType) || includes & 16777216 /* IncludesEmptyObject */)) {
|
|
62714
62710
|
const constraint = getBaseConstraintOfType(typeVariable);
|
|
62715
62711
|
if (constraint && everyType(constraint, (t) => !!(t.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */)) || isEmptyAnonymousObjectType(t))) {
|
|
62716
62712
|
if (isTypeStrictSubtypeOf(constraint, primitiveType)) {
|
|
@@ -63318,6 +63314,9 @@ function createTypeChecker(host) {
|
|
|
63318
63314
|
function isPatternLiteralType(type) {
|
|
63319
63315
|
return !!(type.flags & 134217728 /* TemplateLiteral */) && every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 268435456 /* StringMapping */) && isPatternLiteralPlaceholderType(type.type);
|
|
63320
63316
|
}
|
|
63317
|
+
function isGenericStringLikeType(type) {
|
|
63318
|
+
return !!(type.flags & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) && !isPatternLiteralType(type);
|
|
63319
|
+
}
|
|
63321
63320
|
function isGenericType(type) {
|
|
63322
63321
|
return !!getGenericObjectFlags(type);
|
|
63323
63322
|
}
|
|
@@ -63340,7 +63339,7 @@ function createTypeChecker(host) {
|
|
|
63340
63339
|
}
|
|
63341
63340
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
63342
63341
|
}
|
|
63343
|
-
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */
|
|
63342
|
+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */) || isGenericStringLikeType(type) ? 8388608 /* IsGenericIndexType */ : 0);
|
|
63344
63343
|
}
|
|
63345
63344
|
function getSimplifiedType(type, writing) {
|
|
63346
63345
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -64439,29 +64438,28 @@ function createTypeChecker(host) {
|
|
|
64439
64438
|
if (typeVariable) {
|
|
64440
64439
|
const mappedTypeVariable = instantiateType(typeVariable, mapper);
|
|
64441
64440
|
if (typeVariable !== mappedTypeVariable) {
|
|
64442
|
-
return mapTypeWithAlias(
|
|
64443
|
-
getReducedType(mappedTypeVariable),
|
|
64444
|
-
(t) => {
|
|
64445
|
-
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
64446
|
-
if (!type.declaration.nameType) {
|
|
64447
|
-
let constraint;
|
|
64448
|
-
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
64449
|
-
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
64450
|
-
}
|
|
64451
|
-
if (isTupleType(t)) {
|
|
64452
|
-
return instantiateMappedTupleType(t, type, typeVariable, mapper);
|
|
64453
|
-
}
|
|
64454
|
-
}
|
|
64455
|
-
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
|
|
64456
|
-
}
|
|
64457
|
-
return t;
|
|
64458
|
-
},
|
|
64459
|
-
aliasSymbol,
|
|
64460
|
-
aliasTypeArguments
|
|
64461
|
-
);
|
|
64441
|
+
return mapTypeWithAlias(getReducedType(mappedTypeVariable), instantiateConstituent, aliasSymbol, aliasTypeArguments);
|
|
64462
64442
|
}
|
|
64463
64443
|
}
|
|
64464
64444
|
return instantiateType(getConstraintTypeFromMappedType(type), mapper) === wildcardType ? wildcardType : instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments);
|
|
64445
|
+
function instantiateConstituent(t) {
|
|
64446
|
+
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
64447
|
+
if (!type.declaration.nameType) {
|
|
64448
|
+
let constraint;
|
|
64449
|
+
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
64450
|
+
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
64451
|
+
}
|
|
64452
|
+
if (isTupleType(t)) {
|
|
64453
|
+
return instantiateMappedTupleType(t, type, typeVariable, mapper);
|
|
64454
|
+
}
|
|
64455
|
+
if (isArrayOrTupleOrIntersection(t)) {
|
|
64456
|
+
return getIntersectionType(map(t.types, instantiateConstituent));
|
|
64457
|
+
}
|
|
64458
|
+
}
|
|
64459
|
+
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
|
|
64460
|
+
}
|
|
64461
|
+
return t;
|
|
64462
|
+
}
|
|
64465
64463
|
}
|
|
64466
64464
|
function getModifiedReadonlyState(state, modifiers) {
|
|
64467
64465
|
return modifiers & 1 /* IncludeReadonly */ ? true : modifiers & 2 /* ExcludeReadonly */ ? false : state;
|
|
@@ -70388,7 +70386,7 @@ function createTypeChecker(host) {
|
|
|
70388
70386
|
function hasMatchingArgument(expression, reference) {
|
|
70389
70387
|
if (expression.arguments) {
|
|
70390
70388
|
for (const argument of expression.arguments) {
|
|
70391
|
-
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference)
|
|
70389
|
+
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference)) {
|
|
70392
70390
|
return true;
|
|
70393
70391
|
}
|
|
70394
70392
|
}
|
|
@@ -70398,36 +70396,6 @@ function createTypeChecker(host) {
|
|
|
70398
70396
|
}
|
|
70399
70397
|
return false;
|
|
70400
70398
|
}
|
|
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
|
-
}
|
|
70431
70399
|
function getFlowNodeId(flow) {
|
|
70432
70400
|
if (!flow.id || flow.id < 0) {
|
|
70433
70401
|
flow.id = nextFlowId;
|
|
@@ -71527,9 +71495,39 @@ function createTypeChecker(host) {
|
|
|
71527
71495
|
}
|
|
71528
71496
|
return result;
|
|
71529
71497
|
}
|
|
71498
|
+
function getCandidateDiscriminantPropertyAccess(expr) {
|
|
71499
|
+
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
|
|
71500
|
+
if (isIdentifier(expr)) {
|
|
71501
|
+
const symbol = getResolvedSymbol(expr);
|
|
71502
|
+
const declaration = symbol.valueDeclaration;
|
|
71503
|
+
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
71504
|
+
return declaration;
|
|
71505
|
+
}
|
|
71506
|
+
}
|
|
71507
|
+
} else if (isAccessExpression(expr)) {
|
|
71508
|
+
if (isMatchingReference(reference, expr.expression)) {
|
|
71509
|
+
return expr;
|
|
71510
|
+
}
|
|
71511
|
+
} else if (isIdentifier(expr)) {
|
|
71512
|
+
const symbol = getResolvedSymbol(expr);
|
|
71513
|
+
if (isConstantVariable(symbol)) {
|
|
71514
|
+
const declaration = symbol.valueDeclaration;
|
|
71515
|
+
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
|
|
71516
|
+
return declaration.initializer;
|
|
71517
|
+
}
|
|
71518
|
+
if (isBindingElement(declaration) && !declaration.initializer) {
|
|
71519
|
+
const parent2 = declaration.parent.parent;
|
|
71520
|
+
if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) {
|
|
71521
|
+
return declaration;
|
|
71522
|
+
}
|
|
71523
|
+
}
|
|
71524
|
+
}
|
|
71525
|
+
}
|
|
71526
|
+
return void 0;
|
|
71527
|
+
}
|
|
71530
71528
|
function getDiscriminantPropertyAccess(expr, computedType) {
|
|
71531
71529
|
if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
|
|
71532
|
-
const access = getCandidateDiscriminantPropertyAccess(expr
|
|
71530
|
+
const access = getCandidateDiscriminantPropertyAccess(expr);
|
|
71533
71531
|
if (access) {
|
|
71534
71532
|
const name = getAccessedPropertyName(access);
|
|
71535
71533
|
if (name) {
|
|
@@ -77250,7 +77248,7 @@ function createTypeChecker(host) {
|
|
|
77250
77248
|
}
|
|
77251
77249
|
return resolveErrorCall(node);
|
|
77252
77250
|
}
|
|
77253
|
-
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(
|
|
77251
|
+
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
|
|
77254
77252
|
skippedGenericFunction(node, checkMode);
|
|
77255
77253
|
return resolvingSignature;
|
|
77256
77254
|
}
|
|
@@ -77260,12 +77258,8 @@ function createTypeChecker(host) {
|
|
|
77260
77258
|
}
|
|
77261
77259
|
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
77262
77260
|
}
|
|
77263
|
-
function
|
|
77264
|
-
|
|
77265
|
-
return false;
|
|
77266
|
-
}
|
|
77267
|
-
const returnType = getReturnTypeOfSignature(signature);
|
|
77268
|
-
return isFunctionType(returnType) || isConstructorType(returnType);
|
|
77261
|
+
function isGenericFunctionReturningFunction(signature) {
|
|
77262
|
+
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
|
|
77269
77263
|
}
|
|
77270
77264
|
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
|
|
77271
77265
|
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144 /* TypeParameter */) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576 /* Union */) && !(getReducedType(apparentFuncType).flags & 131072 /* Never */) && isTypeAssignableTo(funcType, globalFunctionType);
|
|
@@ -85422,7 +85416,7 @@ function createTypeChecker(host) {
|
|
|
85422
85416
|
error2(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
|
|
85423
85417
|
} else {
|
|
85424
85418
|
const text = getTextOfPropertyName(member.name);
|
|
85425
|
-
if (isNumericLiteralName(text)) {
|
|
85419
|
+
if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {
|
|
85426
85420
|
error2(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name);
|
|
85427
85421
|
}
|
|
85428
85422
|
}
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.4";
|
|
38
|
-
version = "5.4.
|
|
38
|
+
version = "5.4.3";
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -50016,13 +50016,6 @@ ${lanes.join("\n")}
|
|
|
50016
50016
|
});
|
|
50017
50017
|
}
|
|
50018
50018
|
function getSymbolIfSameReference(s1, s2) {
|
|
50019
|
-
var _a, _b;
|
|
50020
|
-
if (s1.flags & 524288 /* TypeAlias */ && ((_a = s2.declarations) == null ? void 0 : _a.find(isTypeAlias))) {
|
|
50021
|
-
s2 = getDeclaredTypeOfTypeAlias(s2).aliasSymbol || s2;
|
|
50022
|
-
}
|
|
50023
|
-
if (s2.flags & 524288 /* TypeAlias */ && ((_b = s1.declarations) == null ? void 0 : _b.find(isTypeAlias))) {
|
|
50024
|
-
s1 = getDeclaredTypeOfTypeAlias(s1).aliasSymbol || s1;
|
|
50025
|
-
}
|
|
50026
50019
|
if (getMergedSymbol(resolveSymbol(getMergedSymbol(s1))) === getMergedSymbol(resolveSymbol(getMergedSymbol(s2)))) {
|
|
50027
50020
|
return s1;
|
|
50028
50021
|
}
|
|
@@ -57820,13 +57813,16 @@ ${lanes.join("\n")}
|
|
|
57820
57813
|
const constraint = getConstraintTypeFromMappedType(type);
|
|
57821
57814
|
if (constraint.flags & 4194304 /* Index */) {
|
|
57822
57815
|
const baseConstraint = getBaseConstraintOfType(constraint.type);
|
|
57823
|
-
if (baseConstraint && everyType(baseConstraint, isArrayOrTupleType)) {
|
|
57816
|
+
if (baseConstraint && everyType(baseConstraint, (t) => isArrayOrTupleType(t) || isArrayOrTupleOrIntersection(t))) {
|
|
57824
57817
|
return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
|
|
57825
57818
|
}
|
|
57826
57819
|
}
|
|
57827
57820
|
}
|
|
57828
57821
|
return type;
|
|
57829
57822
|
}
|
|
57823
|
+
function isArrayOrTupleOrIntersection(type) {
|
|
57824
|
+
return !!(type.flags & 2097152 /* Intersection */) && every(type.types, isArrayOrTupleType);
|
|
57825
|
+
}
|
|
57830
57826
|
function isMappedTypeGenericIndexedAccess(type) {
|
|
57831
57827
|
let objectType;
|
|
57832
57828
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
@@ -60465,7 +60461,7 @@ ${lanes.join("\n")}
|
|
|
60465
60461
|
const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
60466
60462
|
const typeVariable = typeSet[typeVarIndex];
|
|
60467
60463
|
const primitiveType = typeSet[1 - typeVarIndex];
|
|
60468
|
-
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) || includes & 16777216 /* IncludesEmptyObject */)) {
|
|
60464
|
+
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) && !isGenericStringLikeType(primitiveType) || includes & 16777216 /* IncludesEmptyObject */)) {
|
|
60469
60465
|
const constraint = getBaseConstraintOfType(typeVariable);
|
|
60470
60466
|
if (constraint && everyType(constraint, (t) => !!(t.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */)) || isEmptyAnonymousObjectType(t))) {
|
|
60471
60467
|
if (isTypeStrictSubtypeOf(constraint, primitiveType)) {
|
|
@@ -61073,6 +61069,9 @@ ${lanes.join("\n")}
|
|
|
61073
61069
|
function isPatternLiteralType(type) {
|
|
61074
61070
|
return !!(type.flags & 134217728 /* TemplateLiteral */) && every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 268435456 /* StringMapping */) && isPatternLiteralPlaceholderType(type.type);
|
|
61075
61071
|
}
|
|
61072
|
+
function isGenericStringLikeType(type) {
|
|
61073
|
+
return !!(type.flags & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) && !isPatternLiteralType(type);
|
|
61074
|
+
}
|
|
61076
61075
|
function isGenericType(type) {
|
|
61077
61076
|
return !!getGenericObjectFlags(type);
|
|
61078
61077
|
}
|
|
@@ -61095,7 +61094,7 @@ ${lanes.join("\n")}
|
|
|
61095
61094
|
}
|
|
61096
61095
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
61097
61096
|
}
|
|
61098
|
-
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */
|
|
61097
|
+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */) || isGenericStringLikeType(type) ? 8388608 /* IsGenericIndexType */ : 0);
|
|
61099
61098
|
}
|
|
61100
61099
|
function getSimplifiedType(type, writing) {
|
|
61101
61100
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -62194,29 +62193,28 @@ ${lanes.join("\n")}
|
|
|
62194
62193
|
if (typeVariable) {
|
|
62195
62194
|
const mappedTypeVariable = instantiateType(typeVariable, mapper);
|
|
62196
62195
|
if (typeVariable !== mappedTypeVariable) {
|
|
62197
|
-
return mapTypeWithAlias(
|
|
62198
|
-
getReducedType(mappedTypeVariable),
|
|
62199
|
-
(t) => {
|
|
62200
|
-
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
62201
|
-
if (!type.declaration.nameType) {
|
|
62202
|
-
let constraint;
|
|
62203
|
-
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
62204
|
-
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
62205
|
-
}
|
|
62206
|
-
if (isTupleType(t)) {
|
|
62207
|
-
return instantiateMappedTupleType(t, type, typeVariable, mapper);
|
|
62208
|
-
}
|
|
62209
|
-
}
|
|
62210
|
-
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
|
|
62211
|
-
}
|
|
62212
|
-
return t;
|
|
62213
|
-
},
|
|
62214
|
-
aliasSymbol,
|
|
62215
|
-
aliasTypeArguments
|
|
62216
|
-
);
|
|
62196
|
+
return mapTypeWithAlias(getReducedType(mappedTypeVariable), instantiateConstituent, aliasSymbol, aliasTypeArguments);
|
|
62217
62197
|
}
|
|
62218
62198
|
}
|
|
62219
62199
|
return instantiateType(getConstraintTypeFromMappedType(type), mapper) === wildcardType ? wildcardType : instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments);
|
|
62200
|
+
function instantiateConstituent(t) {
|
|
62201
|
+
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
62202
|
+
if (!type.declaration.nameType) {
|
|
62203
|
+
let constraint;
|
|
62204
|
+
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
62205
|
+
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
62206
|
+
}
|
|
62207
|
+
if (isTupleType(t)) {
|
|
62208
|
+
return instantiateMappedTupleType(t, type, typeVariable, mapper);
|
|
62209
|
+
}
|
|
62210
|
+
if (isArrayOrTupleOrIntersection(t)) {
|
|
62211
|
+
return getIntersectionType(map(t.types, instantiateConstituent));
|
|
62212
|
+
}
|
|
62213
|
+
}
|
|
62214
|
+
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
|
|
62215
|
+
}
|
|
62216
|
+
return t;
|
|
62217
|
+
}
|
|
62220
62218
|
}
|
|
62221
62219
|
function getModifiedReadonlyState(state, modifiers) {
|
|
62222
62220
|
return modifiers & 1 /* IncludeReadonly */ ? true : modifiers & 2 /* ExcludeReadonly */ ? false : state;
|
|
@@ -68143,7 +68141,7 @@ ${lanes.join("\n")}
|
|
|
68143
68141
|
function hasMatchingArgument(expression, reference) {
|
|
68144
68142
|
if (expression.arguments) {
|
|
68145
68143
|
for (const argument of expression.arguments) {
|
|
68146
|
-
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference)
|
|
68144
|
+
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference)) {
|
|
68147
68145
|
return true;
|
|
68148
68146
|
}
|
|
68149
68147
|
}
|
|
@@ -68153,36 +68151,6 @@ ${lanes.join("\n")}
|
|
|
68153
68151
|
}
|
|
68154
68152
|
return false;
|
|
68155
68153
|
}
|
|
68156
|
-
function getCandidateDiscriminantPropertyAccess(expr, reference) {
|
|
68157
|
-
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
|
|
68158
|
-
if (isIdentifier(expr)) {
|
|
68159
|
-
const symbol = getResolvedSymbol(expr);
|
|
68160
|
-
const declaration = symbol.valueDeclaration;
|
|
68161
|
-
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
68162
|
-
return declaration;
|
|
68163
|
-
}
|
|
68164
|
-
}
|
|
68165
|
-
} else if (isAccessExpression(expr)) {
|
|
68166
|
-
if (isMatchingReference(reference, expr.expression)) {
|
|
68167
|
-
return expr;
|
|
68168
|
-
}
|
|
68169
|
-
} else if (isIdentifier(expr)) {
|
|
68170
|
-
const symbol = getResolvedSymbol(expr);
|
|
68171
|
-
if (isConstantVariable(symbol)) {
|
|
68172
|
-
const declaration = symbol.valueDeclaration;
|
|
68173
|
-
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
|
|
68174
|
-
return declaration.initializer;
|
|
68175
|
-
}
|
|
68176
|
-
if (isBindingElement(declaration) && !declaration.initializer) {
|
|
68177
|
-
const parent2 = declaration.parent.parent;
|
|
68178
|
-
if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) {
|
|
68179
|
-
return declaration;
|
|
68180
|
-
}
|
|
68181
|
-
}
|
|
68182
|
-
}
|
|
68183
|
-
}
|
|
68184
|
-
return void 0;
|
|
68185
|
-
}
|
|
68186
68154
|
function getFlowNodeId(flow) {
|
|
68187
68155
|
if (!flow.id || flow.id < 0) {
|
|
68188
68156
|
flow.id = nextFlowId;
|
|
@@ -69282,9 +69250,39 @@ ${lanes.join("\n")}
|
|
|
69282
69250
|
}
|
|
69283
69251
|
return result;
|
|
69284
69252
|
}
|
|
69253
|
+
function getCandidateDiscriminantPropertyAccess(expr) {
|
|
69254
|
+
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
|
|
69255
|
+
if (isIdentifier(expr)) {
|
|
69256
|
+
const symbol = getResolvedSymbol(expr);
|
|
69257
|
+
const declaration = symbol.valueDeclaration;
|
|
69258
|
+
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
69259
|
+
return declaration;
|
|
69260
|
+
}
|
|
69261
|
+
}
|
|
69262
|
+
} else if (isAccessExpression(expr)) {
|
|
69263
|
+
if (isMatchingReference(reference, expr.expression)) {
|
|
69264
|
+
return expr;
|
|
69265
|
+
}
|
|
69266
|
+
} else if (isIdentifier(expr)) {
|
|
69267
|
+
const symbol = getResolvedSymbol(expr);
|
|
69268
|
+
if (isConstantVariable(symbol)) {
|
|
69269
|
+
const declaration = symbol.valueDeclaration;
|
|
69270
|
+
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
|
|
69271
|
+
return declaration.initializer;
|
|
69272
|
+
}
|
|
69273
|
+
if (isBindingElement(declaration) && !declaration.initializer) {
|
|
69274
|
+
const parent2 = declaration.parent.parent;
|
|
69275
|
+
if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) {
|
|
69276
|
+
return declaration;
|
|
69277
|
+
}
|
|
69278
|
+
}
|
|
69279
|
+
}
|
|
69280
|
+
}
|
|
69281
|
+
return void 0;
|
|
69282
|
+
}
|
|
69285
69283
|
function getDiscriminantPropertyAccess(expr, computedType) {
|
|
69286
69284
|
if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
|
|
69287
|
-
const access = getCandidateDiscriminantPropertyAccess(expr
|
|
69285
|
+
const access = getCandidateDiscriminantPropertyAccess(expr);
|
|
69288
69286
|
if (access) {
|
|
69289
69287
|
const name = getAccessedPropertyName(access);
|
|
69290
69288
|
if (name) {
|
|
@@ -75005,7 +75003,7 @@ ${lanes.join("\n")}
|
|
|
75005
75003
|
}
|
|
75006
75004
|
return resolveErrorCall(node);
|
|
75007
75005
|
}
|
|
75008
|
-
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(
|
|
75006
|
+
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
|
|
75009
75007
|
skippedGenericFunction(node, checkMode);
|
|
75010
75008
|
return resolvingSignature;
|
|
75011
75009
|
}
|
|
@@ -75015,12 +75013,8 @@ ${lanes.join("\n")}
|
|
|
75015
75013
|
}
|
|
75016
75014
|
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
75017
75015
|
}
|
|
75018
|
-
function
|
|
75019
|
-
|
|
75020
|
-
return false;
|
|
75021
|
-
}
|
|
75022
|
-
const returnType = getReturnTypeOfSignature(signature);
|
|
75023
|
-
return isFunctionType(returnType) || isConstructorType(returnType);
|
|
75016
|
+
function isGenericFunctionReturningFunction(signature) {
|
|
75017
|
+
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
|
|
75024
75018
|
}
|
|
75025
75019
|
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
|
|
75026
75020
|
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144 /* TypeParameter */) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576 /* Union */) && !(getReducedType(apparentFuncType).flags & 131072 /* Never */) && isTypeAssignableTo(funcType, globalFunctionType);
|
|
@@ -83177,7 +83171,7 @@ ${lanes.join("\n")}
|
|
|
83177
83171
|
error2(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
|
|
83178
83172
|
} else {
|
|
83179
83173
|
const text = getTextOfPropertyName(member.name);
|
|
83180
|
-
if (isNumericLiteralName(text)) {
|
|
83174
|
+
if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {
|
|
83181
83175
|
error2(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name);
|
|
83182
83176
|
}
|
|
83183
83177
|
}
|
package/lib/typingsInstaller.js
CHANGED
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.4.
|
|
5
|
+
"version": "5.4.3",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|