@typescript-deploys/pr-build 5.4.0-pr-55842-40 → 5.4.0-pr-57122-21
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 +33 -34
- package/lib/tsserver.js +34 -35
- package/lib/typescript.js +34 -35
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -55315,11 +55315,15 @@ function createTypeChecker(host) {
|
|
|
55315
55315
|
return type.resolvedApparentType || (type.resolvedApparentType = getResolvedApparentTypeOfMappedType(type));
|
|
55316
55316
|
}
|
|
55317
55317
|
function getResolvedApparentTypeOfMappedType(type) {
|
|
55318
|
-
const
|
|
55319
|
-
|
|
55320
|
-
|
|
55321
|
-
|
|
55322
|
-
|
|
55318
|
+
const target = type.target ?? type;
|
|
55319
|
+
const typeVariable = getHomomorphicTypeVariable(target);
|
|
55320
|
+
if (typeVariable && !target.declaration.nameType) {
|
|
55321
|
+
const constraint = getConstraintTypeFromMappedType(type);
|
|
55322
|
+
if (constraint.flags & 4194304 /* Index */) {
|
|
55323
|
+
const baseConstraint = getBaseConstraintOfType(constraint.type);
|
|
55324
|
+
if (baseConstraint && everyType(baseConstraint, isArrayOrTupleType)) {
|
|
55325
|
+
return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
|
|
55326
|
+
}
|
|
55323
55327
|
}
|
|
55324
55328
|
}
|
|
55325
55329
|
return type;
|
|
@@ -57358,7 +57362,7 @@ function createTypeChecker(host) {
|
|
|
57358
57362
|
return target.objectFlags & 8 /* Tuple */ ? createNormalizedTupleType(target, typeArguments) : createTypeReference(target, typeArguments);
|
|
57359
57363
|
}
|
|
57360
57364
|
function createNormalizedTupleType(target, elementTypes) {
|
|
57361
|
-
var _a, _b, _c;
|
|
57365
|
+
var _a, _b, _c, _d;
|
|
57362
57366
|
if (!(target.combinedFlags & 14 /* NonRequired */)) {
|
|
57363
57367
|
return createTypeReference(target, elementTypes);
|
|
57364
57368
|
}
|
|
@@ -57378,8 +57382,10 @@ function createTypeChecker(host) {
|
|
|
57378
57382
|
const type = elementTypes[i];
|
|
57379
57383
|
const flags = target.elementFlags[i];
|
|
57380
57384
|
if (flags & 8 /* Variadic */) {
|
|
57381
|
-
if (type.flags &
|
|
57382
|
-
addElement(type,
|
|
57385
|
+
if (type.flags & 1 /* Any */) {
|
|
57386
|
+
addElement(type, 4 /* Rest */, (_a = target.labeledElementDeclarations) == null ? void 0 : _a[i]);
|
|
57387
|
+
} else if (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type)) {
|
|
57388
|
+
addElement(type, 8 /* Variadic */, (_b = target.labeledElementDeclarations) == null ? void 0 : _b[i]);
|
|
57383
57389
|
} else if (isTupleType(type)) {
|
|
57384
57390
|
const elements = getElementTypes(type);
|
|
57385
57391
|
if (elements.length + expandedTypes.length >= 1e4) {
|
|
@@ -57394,10 +57400,10 @@ function createTypeChecker(host) {
|
|
|
57394
57400
|
return addElement(t, type.target.elementFlags[n], (_a2 = type.target.labeledElementDeclarations) == null ? void 0 : _a2[n]);
|
|
57395
57401
|
});
|
|
57396
57402
|
} else {
|
|
57397
|
-
addElement(isArrayLikeType(type) && getIndexTypeOfType(type, numberType) || errorType, 4 /* Rest */, (
|
|
57403
|
+
addElement(isArrayLikeType(type) && getIndexTypeOfType(type, numberType) || errorType, 4 /* Rest */, (_c = target.labeledElementDeclarations) == null ? void 0 : _c[i]);
|
|
57398
57404
|
}
|
|
57399
57405
|
} else {
|
|
57400
|
-
addElement(type, flags, (
|
|
57406
|
+
addElement(type, flags, (_d = target.labeledElementDeclarations) == null ? void 0 : _d[i]);
|
|
57401
57407
|
}
|
|
57402
57408
|
}
|
|
57403
57409
|
for (let i = 0; i < lastRequiredIndex; i++) {
|
|
@@ -58408,9 +58414,6 @@ function createTypeChecker(host) {
|
|
|
58408
58414
|
if (objectType.flags & (1 /* Any */ | 131072 /* Never */)) {
|
|
58409
58415
|
return objectType;
|
|
58410
58416
|
}
|
|
58411
|
-
if (indexType === neverType || indexType === implicitNeverType) {
|
|
58412
|
-
return neverType;
|
|
58413
|
-
}
|
|
58414
58417
|
const indexInfo = getApplicableIndexInfo(objectType, indexType) || getIndexInfoOfType(objectType, stringType);
|
|
58415
58418
|
if (indexInfo) {
|
|
58416
58419
|
if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
|
|
@@ -58434,6 +58437,9 @@ function createTypeChecker(host) {
|
|
|
58434
58437
|
}
|
|
58435
58438
|
return indexInfo.type;
|
|
58436
58439
|
}
|
|
58440
|
+
if (indexType.flags & 131072 /* Never */) {
|
|
58441
|
+
return neverType;
|
|
58442
|
+
}
|
|
58437
58443
|
if (isJSLiteralType(objectType)) {
|
|
58438
58444
|
return anyType;
|
|
58439
58445
|
}
|
|
@@ -58692,7 +58698,7 @@ function createTypeChecker(host) {
|
|
|
58692
58698
|
return wildcardType;
|
|
58693
58699
|
}
|
|
58694
58700
|
objectType = getReducedType(objectType);
|
|
58695
|
-
if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) &&
|
|
58701
|
+
if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
58696
58702
|
indexType = stringType;
|
|
58697
58703
|
}
|
|
58698
58704
|
if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
|
|
@@ -58761,10 +58767,6 @@ function createTypeChecker(host) {
|
|
|
58761
58767
|
}
|
|
58762
58768
|
return type;
|
|
58763
58769
|
}
|
|
58764
|
-
function maybeCloneTypeParameter(p) {
|
|
58765
|
-
const constraint = getConstraintOfTypeParameter(p);
|
|
58766
|
-
return constraint && (isGenericObjectType(constraint) || isGenericIndexType(constraint)) ? cloneTypeParameter(p) : p;
|
|
58767
|
-
}
|
|
58768
58770
|
function isSimpleTupleType(node) {
|
|
58769
58771
|
return isTupleTypeNode(node) && length(node.elements) > 0 && !some(node.elements, (e) => isOptionalTypeNode(e) || isRestTypeNode(e) || isNamedTupleMember(e) && !!(e.questionToken || e.dotDotDotToken));
|
|
58770
58772
|
}
|
|
@@ -58794,27 +58796,19 @@ function createTypeChecker(host) {
|
|
|
58794
58796
|
const checkTypeDeferred = isDeferredType(checkType, checkTuples);
|
|
58795
58797
|
let combinedMapper;
|
|
58796
58798
|
if (root.inferTypeParameters) {
|
|
58797
|
-
const freshParams = sameMap(root.inferTypeParameters, maybeCloneTypeParameter);
|
|
58798
|
-
const freshMapper = freshParams !== root.inferTypeParameters ? createTypeMapper(root.inferTypeParameters, freshParams) : void 0;
|
|
58799
58799
|
const context = createInferenceContext(
|
|
58800
|
-
|
|
58800
|
+
root.inferTypeParameters,
|
|
58801
58801
|
/*signature*/
|
|
58802
58802
|
void 0,
|
|
58803
58803
|
0 /* None */
|
|
58804
58804
|
);
|
|
58805
|
-
if (
|
|
58806
|
-
|
|
58807
|
-
for (let i = 0; i < freshParams.length; i++) {
|
|
58808
|
-
if (freshParams[i] !== root.inferTypeParameters[i]) {
|
|
58809
|
-
freshParams[i].mapper = freshCombinedMapper;
|
|
58810
|
-
}
|
|
58811
|
-
}
|
|
58805
|
+
if (mapper) {
|
|
58806
|
+
context.nonFixingMapper = combineTypeMappers(context.nonFixingMapper, mapper);
|
|
58812
58807
|
}
|
|
58813
58808
|
if (!checkTypeDeferred) {
|
|
58814
|
-
inferTypes(context.inferences, checkType,
|
|
58809
|
+
inferTypes(context.inferences, checkType, extendsType, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
|
|
58815
58810
|
}
|
|
58816
|
-
|
|
58817
|
-
combinedMapper = mapper ? combineTypeMappers(innerMapper, mapper) : innerMapper;
|
|
58811
|
+
combinedMapper = mapper ? combineTypeMappers(context.mapper, mapper) : context.mapper;
|
|
58818
58812
|
}
|
|
58819
58813
|
const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
|
|
58820
58814
|
if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
|
|
@@ -60666,8 +60660,8 @@ function createTypeChecker(host) {
|
|
|
60666
60660
|
const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
|
|
60667
60661
|
const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
|
|
60668
60662
|
for (let i = 0; i < paramCount; i++) {
|
|
60669
|
-
const sourceType = i === restIndex ?
|
|
60670
|
-
const targetType = i === restIndex ?
|
|
60663
|
+
const sourceType = i === restIndex ? getRestOrAnyTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
|
|
60664
|
+
const targetType = i === restIndex ? getRestOrAnyTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
60671
60665
|
if (sourceType && targetType) {
|
|
60672
60666
|
const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
60673
60667
|
const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
@@ -73670,6 +73664,11 @@ function createTypeChecker(host) {
|
|
|
73670
73664
|
}
|
|
73671
73665
|
return createTupleType(types, flags, readonly, names);
|
|
73672
73666
|
}
|
|
73667
|
+
function getRestOrAnyTypeAtPosition(source, pos) {
|
|
73668
|
+
const restType = getRestTypeAtPosition(source, pos);
|
|
73669
|
+
const elementType = restType && getElementTypeOfArrayType(restType);
|
|
73670
|
+
return elementType && isTypeAny(elementType) ? anyType : restType;
|
|
73671
|
+
}
|
|
73673
73672
|
function getParameterCount(signature) {
|
|
73674
73673
|
const length2 = signature.parameters.length;
|
|
73675
73674
|
if (signatureHasRestParameter(signature)) {
|
|
@@ -73726,7 +73725,7 @@ function createTypeChecker(host) {
|
|
|
73726
73725
|
if (signatureHasRestParameter(signature)) {
|
|
73727
73726
|
const restType = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]);
|
|
73728
73727
|
if (!isTupleType(restType)) {
|
|
73729
|
-
return restType;
|
|
73728
|
+
return isTypeAny(restType) ? anyArrayType : restType;
|
|
73730
73729
|
}
|
|
73731
73730
|
if (restType.target.hasRestElement) {
|
|
73732
73731
|
return sliceTupleType(restType, restType.target.fixedLength);
|
package/lib/tsserver.js
CHANGED
|
@@ -60059,11 +60059,15 @@ function createTypeChecker(host) {
|
|
|
60059
60059
|
return type.resolvedApparentType || (type.resolvedApparentType = getResolvedApparentTypeOfMappedType(type));
|
|
60060
60060
|
}
|
|
60061
60061
|
function getResolvedApparentTypeOfMappedType(type) {
|
|
60062
|
-
const
|
|
60063
|
-
|
|
60064
|
-
|
|
60065
|
-
|
|
60066
|
-
|
|
60062
|
+
const target = type.target ?? type;
|
|
60063
|
+
const typeVariable = getHomomorphicTypeVariable(target);
|
|
60064
|
+
if (typeVariable && !target.declaration.nameType) {
|
|
60065
|
+
const constraint = getConstraintTypeFromMappedType(type);
|
|
60066
|
+
if (constraint.flags & 4194304 /* Index */) {
|
|
60067
|
+
const baseConstraint = getBaseConstraintOfType(constraint.type);
|
|
60068
|
+
if (baseConstraint && everyType(baseConstraint, isArrayOrTupleType)) {
|
|
60069
|
+
return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
|
|
60070
|
+
}
|
|
60067
60071
|
}
|
|
60068
60072
|
}
|
|
60069
60073
|
return type;
|
|
@@ -62102,7 +62106,7 @@ function createTypeChecker(host) {
|
|
|
62102
62106
|
return target.objectFlags & 8 /* Tuple */ ? createNormalizedTupleType(target, typeArguments) : createTypeReference(target, typeArguments);
|
|
62103
62107
|
}
|
|
62104
62108
|
function createNormalizedTupleType(target, elementTypes) {
|
|
62105
|
-
var _a, _b, _c;
|
|
62109
|
+
var _a, _b, _c, _d;
|
|
62106
62110
|
if (!(target.combinedFlags & 14 /* NonRequired */)) {
|
|
62107
62111
|
return createTypeReference(target, elementTypes);
|
|
62108
62112
|
}
|
|
@@ -62122,8 +62126,10 @@ function createTypeChecker(host) {
|
|
|
62122
62126
|
const type = elementTypes[i];
|
|
62123
62127
|
const flags = target.elementFlags[i];
|
|
62124
62128
|
if (flags & 8 /* Variadic */) {
|
|
62125
|
-
if (type.flags &
|
|
62126
|
-
addElement(type,
|
|
62129
|
+
if (type.flags & 1 /* Any */) {
|
|
62130
|
+
addElement(type, 4 /* Rest */, (_a = target.labeledElementDeclarations) == null ? void 0 : _a[i]);
|
|
62131
|
+
} else if (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type)) {
|
|
62132
|
+
addElement(type, 8 /* Variadic */, (_b = target.labeledElementDeclarations) == null ? void 0 : _b[i]);
|
|
62127
62133
|
} else if (isTupleType(type)) {
|
|
62128
62134
|
const elements = getElementTypes(type);
|
|
62129
62135
|
if (elements.length + expandedTypes.length >= 1e4) {
|
|
@@ -62138,10 +62144,10 @@ function createTypeChecker(host) {
|
|
|
62138
62144
|
return addElement(t, type.target.elementFlags[n], (_a2 = type.target.labeledElementDeclarations) == null ? void 0 : _a2[n]);
|
|
62139
62145
|
});
|
|
62140
62146
|
} else {
|
|
62141
|
-
addElement(isArrayLikeType(type) && getIndexTypeOfType(type, numberType) || errorType, 4 /* Rest */, (
|
|
62147
|
+
addElement(isArrayLikeType(type) && getIndexTypeOfType(type, numberType) || errorType, 4 /* Rest */, (_c = target.labeledElementDeclarations) == null ? void 0 : _c[i]);
|
|
62142
62148
|
}
|
|
62143
62149
|
} else {
|
|
62144
|
-
addElement(type, flags, (
|
|
62150
|
+
addElement(type, flags, (_d = target.labeledElementDeclarations) == null ? void 0 : _d[i]);
|
|
62145
62151
|
}
|
|
62146
62152
|
}
|
|
62147
62153
|
for (let i = 0; i < lastRequiredIndex; i++) {
|
|
@@ -63152,9 +63158,6 @@ function createTypeChecker(host) {
|
|
|
63152
63158
|
if (objectType.flags & (1 /* Any */ | 131072 /* Never */)) {
|
|
63153
63159
|
return objectType;
|
|
63154
63160
|
}
|
|
63155
|
-
if (indexType === neverType || indexType === implicitNeverType) {
|
|
63156
|
-
return neverType;
|
|
63157
|
-
}
|
|
63158
63161
|
const indexInfo = getApplicableIndexInfo(objectType, indexType) || getIndexInfoOfType(objectType, stringType);
|
|
63159
63162
|
if (indexInfo) {
|
|
63160
63163
|
if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
|
|
@@ -63178,6 +63181,9 @@ function createTypeChecker(host) {
|
|
|
63178
63181
|
}
|
|
63179
63182
|
return indexInfo.type;
|
|
63180
63183
|
}
|
|
63184
|
+
if (indexType.flags & 131072 /* Never */) {
|
|
63185
|
+
return neverType;
|
|
63186
|
+
}
|
|
63181
63187
|
if (isJSLiteralType(objectType)) {
|
|
63182
63188
|
return anyType;
|
|
63183
63189
|
}
|
|
@@ -63436,7 +63442,7 @@ function createTypeChecker(host) {
|
|
|
63436
63442
|
return wildcardType;
|
|
63437
63443
|
}
|
|
63438
63444
|
objectType = getReducedType(objectType);
|
|
63439
|
-
if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) &&
|
|
63445
|
+
if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
63440
63446
|
indexType = stringType;
|
|
63441
63447
|
}
|
|
63442
63448
|
if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
|
|
@@ -63505,10 +63511,6 @@ function createTypeChecker(host) {
|
|
|
63505
63511
|
}
|
|
63506
63512
|
return type;
|
|
63507
63513
|
}
|
|
63508
|
-
function maybeCloneTypeParameter(p) {
|
|
63509
|
-
const constraint = getConstraintOfTypeParameter(p);
|
|
63510
|
-
return constraint && (isGenericObjectType(constraint) || isGenericIndexType(constraint)) ? cloneTypeParameter(p) : p;
|
|
63511
|
-
}
|
|
63512
63514
|
function isSimpleTupleType(node) {
|
|
63513
63515
|
return isTupleTypeNode(node) && length(node.elements) > 0 && !some(node.elements, (e) => isOptionalTypeNode(e) || isRestTypeNode(e) || isNamedTupleMember(e) && !!(e.questionToken || e.dotDotDotToken));
|
|
63514
63516
|
}
|
|
@@ -63538,27 +63540,19 @@ function createTypeChecker(host) {
|
|
|
63538
63540
|
const checkTypeDeferred = isDeferredType(checkType, checkTuples);
|
|
63539
63541
|
let combinedMapper;
|
|
63540
63542
|
if (root.inferTypeParameters) {
|
|
63541
|
-
const freshParams = sameMap(root.inferTypeParameters, maybeCloneTypeParameter);
|
|
63542
|
-
const freshMapper = freshParams !== root.inferTypeParameters ? createTypeMapper(root.inferTypeParameters, freshParams) : void 0;
|
|
63543
63543
|
const context = createInferenceContext(
|
|
63544
|
-
|
|
63544
|
+
root.inferTypeParameters,
|
|
63545
63545
|
/*signature*/
|
|
63546
63546
|
void 0,
|
|
63547
63547
|
0 /* None */
|
|
63548
63548
|
);
|
|
63549
|
-
if (
|
|
63550
|
-
|
|
63551
|
-
for (let i = 0; i < freshParams.length; i++) {
|
|
63552
|
-
if (freshParams[i] !== root.inferTypeParameters[i]) {
|
|
63553
|
-
freshParams[i].mapper = freshCombinedMapper;
|
|
63554
|
-
}
|
|
63555
|
-
}
|
|
63549
|
+
if (mapper) {
|
|
63550
|
+
context.nonFixingMapper = combineTypeMappers(context.nonFixingMapper, mapper);
|
|
63556
63551
|
}
|
|
63557
63552
|
if (!checkTypeDeferred) {
|
|
63558
|
-
inferTypes(context.inferences, checkType,
|
|
63553
|
+
inferTypes(context.inferences, checkType, extendsType, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
|
|
63559
63554
|
}
|
|
63560
|
-
|
|
63561
|
-
combinedMapper = mapper ? combineTypeMappers(innerMapper, mapper) : innerMapper;
|
|
63555
|
+
combinedMapper = mapper ? combineTypeMappers(context.mapper, mapper) : context.mapper;
|
|
63562
63556
|
}
|
|
63563
63557
|
const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
|
|
63564
63558
|
if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
|
|
@@ -65410,8 +65404,8 @@ function createTypeChecker(host) {
|
|
|
65410
65404
|
const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
|
|
65411
65405
|
const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
|
|
65412
65406
|
for (let i = 0; i < paramCount; i++) {
|
|
65413
|
-
const sourceType = i === restIndex ?
|
|
65414
|
-
const targetType = i === restIndex ?
|
|
65407
|
+
const sourceType = i === restIndex ? getRestOrAnyTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
|
|
65408
|
+
const targetType = i === restIndex ? getRestOrAnyTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
65415
65409
|
if (sourceType && targetType) {
|
|
65416
65410
|
const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
65417
65411
|
const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
@@ -78414,6 +78408,11 @@ function createTypeChecker(host) {
|
|
|
78414
78408
|
}
|
|
78415
78409
|
return createTupleType(types, flags, readonly, names);
|
|
78416
78410
|
}
|
|
78411
|
+
function getRestOrAnyTypeAtPosition(source, pos) {
|
|
78412
|
+
const restType = getRestTypeAtPosition(source, pos);
|
|
78413
|
+
const elementType = restType && getElementTypeOfArrayType(restType);
|
|
78414
|
+
return elementType && isTypeAny(elementType) ? anyType : restType;
|
|
78415
|
+
}
|
|
78417
78416
|
function getParameterCount(signature) {
|
|
78418
78417
|
const length2 = signature.parameters.length;
|
|
78419
78418
|
if (signatureHasRestParameter(signature)) {
|
|
@@ -78470,7 +78469,7 @@ function createTypeChecker(host) {
|
|
|
78470
78469
|
if (signatureHasRestParameter(signature)) {
|
|
78471
78470
|
const restType = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]);
|
|
78472
78471
|
if (!isTupleType(restType)) {
|
|
78473
|
-
return restType;
|
|
78472
|
+
return isTypeAny(restType) ? anyArrayType : restType;
|
|
78474
78473
|
}
|
|
78475
78474
|
if (restType.target.hasRestElement) {
|
|
78476
78475
|
return sliceTupleType(restType, restType.target.fixedLength);
|
|
@@ -162293,7 +162292,7 @@ function isClassMemberCompletionKeyword(kind) {
|
|
|
162293
162292
|
}
|
|
162294
162293
|
}
|
|
162295
162294
|
function isFunctionLikeBodyKeyword(kind) {
|
|
162296
|
-
return kind === 134 /* AsyncKeyword */ || kind === 135 /* AwaitKeyword */ || kind === 130 /* AsKeyword */ || kind === 152 /* SatisfiesKeyword */ || kind === 156 /* TypeKeyword */ || !isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
|
|
162295
|
+
return kind === 134 /* AsyncKeyword */ || kind === 135 /* AwaitKeyword */ || kind === 160 /* UsingKeyword */ || kind === 130 /* AsKeyword */ || kind === 152 /* SatisfiesKeyword */ || kind === 156 /* TypeKeyword */ || !isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
|
|
162297
162296
|
}
|
|
162298
162297
|
function keywordForNode(node) {
|
|
162299
162298
|
return isIdentifier(node) ? identifierToKeywordKind(node) ?? 0 /* Unknown */ : node.kind;
|
package/lib/typescript.js
CHANGED
|
@@ -57814,11 +57814,15 @@ ${lanes.join("\n")}
|
|
|
57814
57814
|
return type.resolvedApparentType || (type.resolvedApparentType = getResolvedApparentTypeOfMappedType(type));
|
|
57815
57815
|
}
|
|
57816
57816
|
function getResolvedApparentTypeOfMappedType(type) {
|
|
57817
|
-
const
|
|
57818
|
-
|
|
57819
|
-
|
|
57820
|
-
|
|
57821
|
-
|
|
57817
|
+
const target = type.target ?? type;
|
|
57818
|
+
const typeVariable = getHomomorphicTypeVariable(target);
|
|
57819
|
+
if (typeVariable && !target.declaration.nameType) {
|
|
57820
|
+
const constraint = getConstraintTypeFromMappedType(type);
|
|
57821
|
+
if (constraint.flags & 4194304 /* Index */) {
|
|
57822
|
+
const baseConstraint = getBaseConstraintOfType(constraint.type);
|
|
57823
|
+
if (baseConstraint && everyType(baseConstraint, isArrayOrTupleType)) {
|
|
57824
|
+
return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
|
|
57825
|
+
}
|
|
57822
57826
|
}
|
|
57823
57827
|
}
|
|
57824
57828
|
return type;
|
|
@@ -59857,7 +59861,7 @@ ${lanes.join("\n")}
|
|
|
59857
59861
|
return target.objectFlags & 8 /* Tuple */ ? createNormalizedTupleType(target, typeArguments) : createTypeReference(target, typeArguments);
|
|
59858
59862
|
}
|
|
59859
59863
|
function createNormalizedTupleType(target, elementTypes) {
|
|
59860
|
-
var _a, _b, _c;
|
|
59864
|
+
var _a, _b, _c, _d;
|
|
59861
59865
|
if (!(target.combinedFlags & 14 /* NonRequired */)) {
|
|
59862
59866
|
return createTypeReference(target, elementTypes);
|
|
59863
59867
|
}
|
|
@@ -59877,8 +59881,10 @@ ${lanes.join("\n")}
|
|
|
59877
59881
|
const type = elementTypes[i];
|
|
59878
59882
|
const flags = target.elementFlags[i];
|
|
59879
59883
|
if (flags & 8 /* Variadic */) {
|
|
59880
|
-
if (type.flags &
|
|
59881
|
-
addElement(type,
|
|
59884
|
+
if (type.flags & 1 /* Any */) {
|
|
59885
|
+
addElement(type, 4 /* Rest */, (_a = target.labeledElementDeclarations) == null ? void 0 : _a[i]);
|
|
59886
|
+
} else if (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type)) {
|
|
59887
|
+
addElement(type, 8 /* Variadic */, (_b = target.labeledElementDeclarations) == null ? void 0 : _b[i]);
|
|
59882
59888
|
} else if (isTupleType(type)) {
|
|
59883
59889
|
const elements = getElementTypes(type);
|
|
59884
59890
|
if (elements.length + expandedTypes.length >= 1e4) {
|
|
@@ -59893,10 +59899,10 @@ ${lanes.join("\n")}
|
|
|
59893
59899
|
return addElement(t, type.target.elementFlags[n], (_a2 = type.target.labeledElementDeclarations) == null ? void 0 : _a2[n]);
|
|
59894
59900
|
});
|
|
59895
59901
|
} else {
|
|
59896
|
-
addElement(isArrayLikeType(type) && getIndexTypeOfType(type, numberType) || errorType, 4 /* Rest */, (
|
|
59902
|
+
addElement(isArrayLikeType(type) && getIndexTypeOfType(type, numberType) || errorType, 4 /* Rest */, (_c = target.labeledElementDeclarations) == null ? void 0 : _c[i]);
|
|
59897
59903
|
}
|
|
59898
59904
|
} else {
|
|
59899
|
-
addElement(type, flags, (
|
|
59905
|
+
addElement(type, flags, (_d = target.labeledElementDeclarations) == null ? void 0 : _d[i]);
|
|
59900
59906
|
}
|
|
59901
59907
|
}
|
|
59902
59908
|
for (let i = 0; i < lastRequiredIndex; i++) {
|
|
@@ -60907,9 +60913,6 @@ ${lanes.join("\n")}
|
|
|
60907
60913
|
if (objectType.flags & (1 /* Any */ | 131072 /* Never */)) {
|
|
60908
60914
|
return objectType;
|
|
60909
60915
|
}
|
|
60910
|
-
if (indexType === neverType || indexType === implicitNeverType) {
|
|
60911
|
-
return neverType;
|
|
60912
|
-
}
|
|
60913
60916
|
const indexInfo = getApplicableIndexInfo(objectType, indexType) || getIndexInfoOfType(objectType, stringType);
|
|
60914
60917
|
if (indexInfo) {
|
|
60915
60918
|
if (accessFlags & 2 /* NoIndexSignatures */ && indexInfo.keyType !== numberType) {
|
|
@@ -60933,6 +60936,9 @@ ${lanes.join("\n")}
|
|
|
60933
60936
|
}
|
|
60934
60937
|
return indexInfo.type;
|
|
60935
60938
|
}
|
|
60939
|
+
if (indexType.flags & 131072 /* Never */) {
|
|
60940
|
+
return neverType;
|
|
60941
|
+
}
|
|
60936
60942
|
if (isJSLiteralType(objectType)) {
|
|
60937
60943
|
return anyType;
|
|
60938
60944
|
}
|
|
@@ -61191,7 +61197,7 @@ ${lanes.join("\n")}
|
|
|
61191
61197
|
return wildcardType;
|
|
61192
61198
|
}
|
|
61193
61199
|
objectType = getReducedType(objectType);
|
|
61194
|
-
if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) &&
|
|
61200
|
+
if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
61195
61201
|
indexType = stringType;
|
|
61196
61202
|
}
|
|
61197
61203
|
if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
|
|
@@ -61260,10 +61266,6 @@ ${lanes.join("\n")}
|
|
|
61260
61266
|
}
|
|
61261
61267
|
return type;
|
|
61262
61268
|
}
|
|
61263
|
-
function maybeCloneTypeParameter(p) {
|
|
61264
|
-
const constraint = getConstraintOfTypeParameter(p);
|
|
61265
|
-
return constraint && (isGenericObjectType(constraint) || isGenericIndexType(constraint)) ? cloneTypeParameter(p) : p;
|
|
61266
|
-
}
|
|
61267
61269
|
function isSimpleTupleType(node) {
|
|
61268
61270
|
return isTupleTypeNode(node) && length(node.elements) > 0 && !some(node.elements, (e) => isOptionalTypeNode(e) || isRestTypeNode(e) || isNamedTupleMember(e) && !!(e.questionToken || e.dotDotDotToken));
|
|
61269
61271
|
}
|
|
@@ -61293,27 +61295,19 @@ ${lanes.join("\n")}
|
|
|
61293
61295
|
const checkTypeDeferred = isDeferredType(checkType, checkTuples);
|
|
61294
61296
|
let combinedMapper;
|
|
61295
61297
|
if (root.inferTypeParameters) {
|
|
61296
|
-
const freshParams = sameMap(root.inferTypeParameters, maybeCloneTypeParameter);
|
|
61297
|
-
const freshMapper = freshParams !== root.inferTypeParameters ? createTypeMapper(root.inferTypeParameters, freshParams) : void 0;
|
|
61298
61298
|
const context = createInferenceContext(
|
|
61299
|
-
|
|
61299
|
+
root.inferTypeParameters,
|
|
61300
61300
|
/*signature*/
|
|
61301
61301
|
void 0,
|
|
61302
61302
|
0 /* None */
|
|
61303
61303
|
);
|
|
61304
|
-
if (
|
|
61305
|
-
|
|
61306
|
-
for (let i = 0; i < freshParams.length; i++) {
|
|
61307
|
-
if (freshParams[i] !== root.inferTypeParameters[i]) {
|
|
61308
|
-
freshParams[i].mapper = freshCombinedMapper;
|
|
61309
|
-
}
|
|
61310
|
-
}
|
|
61304
|
+
if (mapper) {
|
|
61305
|
+
context.nonFixingMapper = combineTypeMappers(context.nonFixingMapper, mapper);
|
|
61311
61306
|
}
|
|
61312
61307
|
if (!checkTypeDeferred) {
|
|
61313
|
-
inferTypes(context.inferences, checkType,
|
|
61308
|
+
inferTypes(context.inferences, checkType, extendsType, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
|
|
61314
61309
|
}
|
|
61315
|
-
|
|
61316
|
-
combinedMapper = mapper ? combineTypeMappers(innerMapper, mapper) : innerMapper;
|
|
61310
|
+
combinedMapper = mapper ? combineTypeMappers(context.mapper, mapper) : context.mapper;
|
|
61317
61311
|
}
|
|
61318
61312
|
const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
|
|
61319
61313
|
if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
|
|
@@ -63165,8 +63159,8 @@ ${lanes.join("\n")}
|
|
|
63165
63159
|
const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
|
|
63166
63160
|
const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
|
|
63167
63161
|
for (let i = 0; i < paramCount; i++) {
|
|
63168
|
-
const sourceType = i === restIndex ?
|
|
63169
|
-
const targetType = i === restIndex ?
|
|
63162
|
+
const sourceType = i === restIndex ? getRestOrAnyTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
|
|
63163
|
+
const targetType = i === restIndex ? getRestOrAnyTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
63170
63164
|
if (sourceType && targetType) {
|
|
63171
63165
|
const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
63172
63166
|
const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
@@ -76169,6 +76163,11 @@ ${lanes.join("\n")}
|
|
|
76169
76163
|
}
|
|
76170
76164
|
return createTupleType(types, flags, readonly, names);
|
|
76171
76165
|
}
|
|
76166
|
+
function getRestOrAnyTypeAtPosition(source, pos) {
|
|
76167
|
+
const restType = getRestTypeAtPosition(source, pos);
|
|
76168
|
+
const elementType = restType && getElementTypeOfArrayType(restType);
|
|
76169
|
+
return elementType && isTypeAny(elementType) ? anyType : restType;
|
|
76170
|
+
}
|
|
76172
76171
|
function getParameterCount(signature) {
|
|
76173
76172
|
const length2 = signature.parameters.length;
|
|
76174
76173
|
if (signatureHasRestParameter(signature)) {
|
|
@@ -76225,7 +76224,7 @@ ${lanes.join("\n")}
|
|
|
76225
76224
|
if (signatureHasRestParameter(signature)) {
|
|
76226
76225
|
const restType = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]);
|
|
76227
76226
|
if (!isTupleType(restType)) {
|
|
76228
|
-
return restType;
|
|
76227
|
+
return isTypeAny(restType) ? anyArrayType : restType;
|
|
76229
76228
|
}
|
|
76230
76229
|
if (restType.target.hasRestElement) {
|
|
76231
76230
|
return sliceTupleType(restType, restType.target.fixedLength);
|
|
@@ -161494,7 +161493,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161494
161493
|
}
|
|
161495
161494
|
}
|
|
161496
161495
|
function isFunctionLikeBodyKeyword(kind) {
|
|
161497
|
-
return kind === 134 /* AsyncKeyword */ || kind === 135 /* AwaitKeyword */ || kind === 130 /* AsKeyword */ || kind === 152 /* SatisfiesKeyword */ || kind === 156 /* TypeKeyword */ || !isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
|
|
161496
|
+
return kind === 134 /* AsyncKeyword */ || kind === 135 /* AwaitKeyword */ || kind === 160 /* UsingKeyword */ || kind === 130 /* AsKeyword */ || kind === 152 /* SatisfiesKeyword */ || kind === 156 /* TypeKeyword */ || !isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
|
|
161498
161497
|
}
|
|
161499
161498
|
function keywordForNode(node) {
|
|
161500
161499
|
return isIdentifier(node) ? identifierToKeywordKind(node) ?? 0 /* Unknown */ : node.kind;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.4.0-pr-
|
|
5
|
+
"version": "5.4.0-pr-57122-21",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"node": "20.1.0",
|
|
115
115
|
"npm": "8.19.4"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "93545ceac9895b9869d310cec38b7cee6eb8e4a8"
|
|
118
118
|
}
|