@typescript-deploys/pr-build 5.4.0-pr-56877-6 → 5.4.0-pr-56875-6
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 +47 -13
- package/lib/tsserver.js +47 -13
- package/lib/typescript.js +47 -13
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -44094,7 +44094,6 @@ function createTypeChecker(host) {
|
|
|
44094
44094
|
);
|
|
44095
44095
|
var errorType = createIntrinsicType(1 /* Any */, "error");
|
|
44096
44096
|
var unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
|
|
44097
|
-
var nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */, "non-inferrable");
|
|
44098
44097
|
var intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic");
|
|
44099
44098
|
var unknownType = createIntrinsicType(2 /* Unknown */, "unknown");
|
|
44100
44099
|
var nonNullUnknownType = createIntrinsicType(
|
|
@@ -44104,6 +44103,7 @@ function createTypeChecker(host) {
|
|
|
44104
44103
|
void 0,
|
|
44105
44104
|
"non-null"
|
|
44106
44105
|
);
|
|
44106
|
+
var nonInferrableUnknownType = createIntrinsicType(2 /* Unknown */, "unknown", 65536 /* ContainsWideningType */, "non-inferrable");
|
|
44107
44107
|
var undefinedType = createIntrinsicType(32768 /* Undefined */, "undefined");
|
|
44108
44108
|
var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768 /* Undefined */, "undefined", 65536 /* ContainsWideningType */, "widening");
|
|
44109
44109
|
var missingType = createIntrinsicType(
|
|
@@ -52654,7 +52654,7 @@ function createTypeChecker(host) {
|
|
|
52654
52654
|
if (reportErrors2 && !declarationBelongsToPrivateAmbientMember(element)) {
|
|
52655
52655
|
reportImplicitAny(element, anyType);
|
|
52656
52656
|
}
|
|
52657
|
-
return includePatternInType ?
|
|
52657
|
+
return includePatternInType ? nonInferrableUnknownType : anyType;
|
|
52658
52658
|
}
|
|
52659
52659
|
function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors2) {
|
|
52660
52660
|
const members = createSymbolTable();
|
|
@@ -60660,7 +60660,7 @@ function createTypeChecker(host) {
|
|
|
60660
60660
|
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
|
|
60661
60661
|
const s = source.flags;
|
|
60662
60662
|
const t = target.flags;
|
|
60663
|
-
if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
|
|
60663
|
+
if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType || source === nonInferrableUnknownType)
|
|
60664
60664
|
return true;
|
|
60665
60665
|
if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
|
|
60666
60666
|
return true;
|
|
@@ -63910,6 +63910,9 @@ function createTypeChecker(host) {
|
|
|
63910
63910
|
result = anyType;
|
|
63911
63911
|
} else if (isObjectLiteralType(type)) {
|
|
63912
63912
|
result = getWidenedTypeOfObjectLiteral(type, context);
|
|
63913
|
+
if (type.pattern) {
|
|
63914
|
+
result.pattern = type.pattern;
|
|
63915
|
+
}
|
|
63913
63916
|
} else if (type.flags & 1048576 /* Union */) {
|
|
63914
63917
|
const unionContext = context || createWideningContext(
|
|
63915
63918
|
/*parent*/
|
|
@@ -63924,6 +63927,9 @@ function createTypeChecker(host) {
|
|
|
63924
63927
|
result = getIntersectionType(sameMap(type.types, getWidenedType));
|
|
63925
63928
|
} else if (isArrayOrTupleType(type)) {
|
|
63926
63929
|
result = createTypeReference(type.target, sameMap(getTypeArguments(type), getWidenedType));
|
|
63930
|
+
if (type.pattern) {
|
|
63931
|
+
result.pattern = type.pattern;
|
|
63932
|
+
}
|
|
63927
63933
|
}
|
|
63928
63934
|
if (result && context === void 0) {
|
|
63929
63935
|
type.widened = result;
|
|
@@ -64257,12 +64263,22 @@ function createTypeChecker(host) {
|
|
|
64257
64263
|
return void 0;
|
|
64258
64264
|
}
|
|
64259
64265
|
if (isArrayType(source)) {
|
|
64260
|
-
|
|
64266
|
+
let reversed2 = createArrayType(inferReverseMappedType(getTypeArguments(source)[0], target, constraint), isReadonlyArrayType(source));
|
|
64267
|
+
if (source.pattern) {
|
|
64268
|
+
reversed2 = cloneTypeReference(reversed2);
|
|
64269
|
+
reversed2.pattern = source.pattern;
|
|
64270
|
+
}
|
|
64271
|
+
return reversed2;
|
|
64261
64272
|
}
|
|
64262
64273
|
if (isTupleType(source)) {
|
|
64263
64274
|
const elementTypes = map(getElementTypes(source), (t) => inferReverseMappedType(t, target, constraint));
|
|
64264
64275
|
const elementFlags = getMappedTypeModifiers(target) & 4 /* IncludeOptional */ ? sameMap(source.target.elementFlags, (f) => f & 2 /* Optional */ ? 1 /* Required */ : f) : source.target.elementFlags;
|
|
64265
|
-
|
|
64276
|
+
let reversed2 = createTupleType(elementTypes, elementFlags, source.target.readonly, source.target.labeledElementDeclarations);
|
|
64277
|
+
if (source.pattern) {
|
|
64278
|
+
reversed2 = cloneTypeReference(reversed2);
|
|
64279
|
+
reversed2.pattern = source.pattern;
|
|
64280
|
+
}
|
|
64281
|
+
return reversed2;
|
|
64266
64282
|
}
|
|
64267
64283
|
const reversed = createObjectType(
|
|
64268
64284
|
1024 /* ReverseMapped */ | 16 /* Anonymous */,
|
|
@@ -64272,6 +64288,9 @@ function createTypeChecker(host) {
|
|
|
64272
64288
|
reversed.source = source;
|
|
64273
64289
|
reversed.mappedType = target;
|
|
64274
64290
|
reversed.constraintType = constraint;
|
|
64291
|
+
if (source.pattern) {
|
|
64292
|
+
reversed.pattern = source.pattern;
|
|
64293
|
+
}
|
|
64275
64294
|
return reversed;
|
|
64276
64295
|
}
|
|
64277
64296
|
function getTypeOfReverseMappedSymbol(symbol) {
|
|
@@ -64286,7 +64305,7 @@ function createTypeChecker(host) {
|
|
|
64286
64305
|
const templateType = getTemplateTypeFromMappedType(target);
|
|
64287
64306
|
const inference = createInferenceInfo(typeParameter);
|
|
64288
64307
|
inferTypes([inference], sourceType, templateType);
|
|
64289
|
-
return getTypeFromInference(inference) || unknownType;
|
|
64308
|
+
return getTypeFromInference(inference) || (sourceType.pattern ? nonInferrableUnknownType : unknownType);
|
|
64290
64309
|
}
|
|
64291
64310
|
function* getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
|
|
64292
64311
|
const properties = getPropertiesOfType(target);
|
|
@@ -64314,7 +64333,7 @@ function createTypeChecker(host) {
|
|
|
64314
64333
|
return firstOrUndefinedIterator(getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties));
|
|
64315
64334
|
}
|
|
64316
64335
|
function tupleTypesDefinitelyUnrelated(source, target) {
|
|
64317
|
-
return !(target.target.combinedFlags & 8 /* Variadic */) && target.target.minLength > source.target.minLength || !target.target.hasRestElement && (source.target.hasRestElement || target.target.fixedLength < source.target.fixedLength);
|
|
64336
|
+
return !source.pattern && (!(target.target.combinedFlags & 8 /* Variadic */) && target.target.minLength > source.target.minLength || !target.target.hasRestElement && (source.target.hasRestElement || target.target.fixedLength < source.target.fixedLength));
|
|
64318
64337
|
}
|
|
64319
64338
|
function typesDefinitelyUnrelated(source, target) {
|
|
64320
64339
|
return isTupleType(source) && isTupleType(target) ? tupleTypesDefinitelyUnrelated(source, target) : !!getUnmatchedProperty(
|
|
@@ -64533,7 +64552,7 @@ function createTypeChecker(host) {
|
|
|
64533
64552
|
}
|
|
64534
64553
|
const inference = getInferenceInfoForType(target);
|
|
64535
64554
|
if (inference) {
|
|
64536
|
-
if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source ===
|
|
64555
|
+
if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source === nonInferrableUnknownType) {
|
|
64537
64556
|
return;
|
|
64538
64557
|
}
|
|
64539
64558
|
if (!inference.isFixed) {
|
|
@@ -65095,12 +65114,16 @@ function createTypeChecker(host) {
|
|
|
65095
65114
|
function getInferredType(context, index) {
|
|
65096
65115
|
const inference = context.inferences[index];
|
|
65097
65116
|
if (!inference.inferredType) {
|
|
65117
|
+
let isFromBindingPattern = false;
|
|
65098
65118
|
let inferredType;
|
|
65099
65119
|
let fallbackType;
|
|
65100
65120
|
if (context.signature) {
|
|
65101
65121
|
const inferredCovariantType = inference.candidates ? getCovariantInference(inference, context.signature) : void 0;
|
|
65102
65122
|
const inferredContravariantType = inference.contraCandidates ? getContravariantInference(inference) : void 0;
|
|
65103
|
-
if (inferredCovariantType
|
|
65123
|
+
if (inferredCovariantType == null ? void 0 : inferredCovariantType.pattern) {
|
|
65124
|
+
isFromBindingPattern = true;
|
|
65125
|
+
inferredType = inferredCovariantType;
|
|
65126
|
+
} else if (inferredCovariantType || inferredContravariantType) {
|
|
65104
65127
|
const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeSubtypeOf(t, inferredCovariantType))));
|
|
65105
65128
|
inferredType = preferCovariantType ? inferredCovariantType : inferredContravariantType;
|
|
65106
65129
|
fallbackType = preferCovariantType ? inferredContravariantType : inferredCovariantType;
|
|
@@ -65119,7 +65142,9 @@ function createTypeChecker(host) {
|
|
|
65119
65142
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
65120
65143
|
if (constraint) {
|
|
65121
65144
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
65122
|
-
if (
|
|
65145
|
+
if (isFromBindingPattern) {
|
|
65146
|
+
inference.inferredType = getIntersectionType([inference.inferredType, instantiatedConstraint]);
|
|
65147
|
+
} else if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
65123
65148
|
inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
|
|
65124
65149
|
}
|
|
65125
65150
|
}
|
|
@@ -68446,7 +68471,16 @@ function createTypeChecker(host) {
|
|
|
68446
68471
|
} else if (t.flags & 3670016 /* StructuredType */) {
|
|
68447
68472
|
const prop = getPropertyOfType(t, name);
|
|
68448
68473
|
if (prop) {
|
|
68449
|
-
|
|
68474
|
+
if (isCircularMappedProperty(prop)) {
|
|
68475
|
+
return void 0;
|
|
68476
|
+
}
|
|
68477
|
+
const type2 = getTypeOfSymbol(prop);
|
|
68478
|
+
if (type2 !== nonInferrableUnknownType) {
|
|
68479
|
+
return removeMissingType(type2, !!(prop && prop.flags & 16777216 /* Optional */));
|
|
68480
|
+
}
|
|
68481
|
+
if (t.flags & 2097152 /* Intersection */) {
|
|
68482
|
+
t = getIntersectionType(t.types.filter((t2) => !t2.pattern));
|
|
68483
|
+
}
|
|
68450
68484
|
}
|
|
68451
68485
|
if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
|
|
68452
68486
|
const restType = getElementTypeOfSliceOfTupleType(
|
|
@@ -69296,7 +69330,7 @@ function createTypeChecker(host) {
|
|
|
69296
69330
|
/*contextFlags*/
|
|
69297
69331
|
void 0
|
|
69298
69332
|
);
|
|
69299
|
-
const contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 206 /* ObjectBindingPattern */ || contextualType.pattern.kind === 210 /* ObjectLiteralExpression */);
|
|
69333
|
+
const contextualTypeHasPattern = !(checkMode & 2 /* Inferential */) && contextualType && contextualType.pattern && (contextualType.pattern.kind === 206 /* ObjectBindingPattern */ || contextualType.pattern.kind === 210 /* ObjectLiteralExpression */);
|
|
69300
69334
|
const inConstContext = isConstContext(node);
|
|
69301
69335
|
const checkFlags = inConstContext ? 8 /* Readonly */ : 0;
|
|
69302
69336
|
const isInJavascript = isInJSFile(node) && !isInJsonFile(node);
|
|
@@ -74042,7 +74076,7 @@ function createTypeChecker(host) {
|
|
|
74042
74076
|
if (!witnesses) {
|
|
74043
74077
|
return false;
|
|
74044
74078
|
}
|
|
74045
|
-
const operandConstraint =
|
|
74079
|
+
const operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression));
|
|
74046
74080
|
const notEqualFacts = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses);
|
|
74047
74081
|
if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
|
|
74048
74082
|
return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
|
package/lib/tsserver.js
CHANGED
|
@@ -48813,7 +48813,6 @@ function createTypeChecker(host) {
|
|
|
48813
48813
|
);
|
|
48814
48814
|
var errorType = createIntrinsicType(1 /* Any */, "error");
|
|
48815
48815
|
var unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
|
|
48816
|
-
var nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */, "non-inferrable");
|
|
48817
48816
|
var intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic");
|
|
48818
48817
|
var unknownType = createIntrinsicType(2 /* Unknown */, "unknown");
|
|
48819
48818
|
var nonNullUnknownType = createIntrinsicType(
|
|
@@ -48823,6 +48822,7 @@ function createTypeChecker(host) {
|
|
|
48823
48822
|
void 0,
|
|
48824
48823
|
"non-null"
|
|
48825
48824
|
);
|
|
48825
|
+
var nonInferrableUnknownType = createIntrinsicType(2 /* Unknown */, "unknown", 65536 /* ContainsWideningType */, "non-inferrable");
|
|
48826
48826
|
var undefinedType = createIntrinsicType(32768 /* Undefined */, "undefined");
|
|
48827
48827
|
var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768 /* Undefined */, "undefined", 65536 /* ContainsWideningType */, "widening");
|
|
48828
48828
|
var missingType = createIntrinsicType(
|
|
@@ -57373,7 +57373,7 @@ function createTypeChecker(host) {
|
|
|
57373
57373
|
if (reportErrors2 && !declarationBelongsToPrivateAmbientMember(element)) {
|
|
57374
57374
|
reportImplicitAny(element, anyType);
|
|
57375
57375
|
}
|
|
57376
|
-
return includePatternInType ?
|
|
57376
|
+
return includePatternInType ? nonInferrableUnknownType : anyType;
|
|
57377
57377
|
}
|
|
57378
57378
|
function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors2) {
|
|
57379
57379
|
const members = createSymbolTable();
|
|
@@ -65379,7 +65379,7 @@ function createTypeChecker(host) {
|
|
|
65379
65379
|
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
|
|
65380
65380
|
const s = source.flags;
|
|
65381
65381
|
const t = target.flags;
|
|
65382
|
-
if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
|
|
65382
|
+
if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType || source === nonInferrableUnknownType)
|
|
65383
65383
|
return true;
|
|
65384
65384
|
if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
|
|
65385
65385
|
return true;
|
|
@@ -68629,6 +68629,9 @@ function createTypeChecker(host) {
|
|
|
68629
68629
|
result = anyType;
|
|
68630
68630
|
} else if (isObjectLiteralType2(type)) {
|
|
68631
68631
|
result = getWidenedTypeOfObjectLiteral(type, context);
|
|
68632
|
+
if (type.pattern) {
|
|
68633
|
+
result.pattern = type.pattern;
|
|
68634
|
+
}
|
|
68632
68635
|
} else if (type.flags & 1048576 /* Union */) {
|
|
68633
68636
|
const unionContext = context || createWideningContext(
|
|
68634
68637
|
/*parent*/
|
|
@@ -68643,6 +68646,9 @@ function createTypeChecker(host) {
|
|
|
68643
68646
|
result = getIntersectionType(sameMap(type.types, getWidenedType));
|
|
68644
68647
|
} else if (isArrayOrTupleType(type)) {
|
|
68645
68648
|
result = createTypeReference(type.target, sameMap(getTypeArguments(type), getWidenedType));
|
|
68649
|
+
if (type.pattern) {
|
|
68650
|
+
result.pattern = type.pattern;
|
|
68651
|
+
}
|
|
68646
68652
|
}
|
|
68647
68653
|
if (result && context === void 0) {
|
|
68648
68654
|
type.widened = result;
|
|
@@ -68976,12 +68982,22 @@ function createTypeChecker(host) {
|
|
|
68976
68982
|
return void 0;
|
|
68977
68983
|
}
|
|
68978
68984
|
if (isArrayType(source)) {
|
|
68979
|
-
|
|
68985
|
+
let reversed2 = createArrayType(inferReverseMappedType(getTypeArguments(source)[0], target, constraint), isReadonlyArrayType(source));
|
|
68986
|
+
if (source.pattern) {
|
|
68987
|
+
reversed2 = cloneTypeReference(reversed2);
|
|
68988
|
+
reversed2.pattern = source.pattern;
|
|
68989
|
+
}
|
|
68990
|
+
return reversed2;
|
|
68980
68991
|
}
|
|
68981
68992
|
if (isTupleType(source)) {
|
|
68982
68993
|
const elementTypes = map(getElementTypes(source), (t) => inferReverseMappedType(t, target, constraint));
|
|
68983
68994
|
const elementFlags = getMappedTypeModifiers(target) & 4 /* IncludeOptional */ ? sameMap(source.target.elementFlags, (f) => f & 2 /* Optional */ ? 1 /* Required */ : f) : source.target.elementFlags;
|
|
68984
|
-
|
|
68995
|
+
let reversed2 = createTupleType(elementTypes, elementFlags, source.target.readonly, source.target.labeledElementDeclarations);
|
|
68996
|
+
if (source.pattern) {
|
|
68997
|
+
reversed2 = cloneTypeReference(reversed2);
|
|
68998
|
+
reversed2.pattern = source.pattern;
|
|
68999
|
+
}
|
|
69000
|
+
return reversed2;
|
|
68985
69001
|
}
|
|
68986
69002
|
const reversed = createObjectType(
|
|
68987
69003
|
1024 /* ReverseMapped */ | 16 /* Anonymous */,
|
|
@@ -68991,6 +69007,9 @@ function createTypeChecker(host) {
|
|
|
68991
69007
|
reversed.source = source;
|
|
68992
69008
|
reversed.mappedType = target;
|
|
68993
69009
|
reversed.constraintType = constraint;
|
|
69010
|
+
if (source.pattern) {
|
|
69011
|
+
reversed.pattern = source.pattern;
|
|
69012
|
+
}
|
|
68994
69013
|
return reversed;
|
|
68995
69014
|
}
|
|
68996
69015
|
function getTypeOfReverseMappedSymbol(symbol) {
|
|
@@ -69005,7 +69024,7 @@ function createTypeChecker(host) {
|
|
|
69005
69024
|
const templateType = getTemplateTypeFromMappedType(target);
|
|
69006
69025
|
const inference = createInferenceInfo(typeParameter);
|
|
69007
69026
|
inferTypes([inference], sourceType, templateType);
|
|
69008
|
-
return getTypeFromInference(inference) || unknownType;
|
|
69027
|
+
return getTypeFromInference(inference) || (sourceType.pattern ? nonInferrableUnknownType : unknownType);
|
|
69009
69028
|
}
|
|
69010
69029
|
function* getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
|
|
69011
69030
|
const properties = getPropertiesOfType(target);
|
|
@@ -69033,7 +69052,7 @@ function createTypeChecker(host) {
|
|
|
69033
69052
|
return firstOrUndefinedIterator(getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties));
|
|
69034
69053
|
}
|
|
69035
69054
|
function tupleTypesDefinitelyUnrelated(source, target) {
|
|
69036
|
-
return !(target.target.combinedFlags & 8 /* Variadic */) && target.target.minLength > source.target.minLength || !target.target.hasRestElement && (source.target.hasRestElement || target.target.fixedLength < source.target.fixedLength);
|
|
69055
|
+
return !source.pattern && (!(target.target.combinedFlags & 8 /* Variadic */) && target.target.minLength > source.target.minLength || !target.target.hasRestElement && (source.target.hasRestElement || target.target.fixedLength < source.target.fixedLength));
|
|
69037
69056
|
}
|
|
69038
69057
|
function typesDefinitelyUnrelated(source, target) {
|
|
69039
69058
|
return isTupleType(source) && isTupleType(target) ? tupleTypesDefinitelyUnrelated(source, target) : !!getUnmatchedProperty(
|
|
@@ -69252,7 +69271,7 @@ function createTypeChecker(host) {
|
|
|
69252
69271
|
}
|
|
69253
69272
|
const inference = getInferenceInfoForType(target);
|
|
69254
69273
|
if (inference) {
|
|
69255
|
-
if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source ===
|
|
69274
|
+
if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source === nonInferrableUnknownType) {
|
|
69256
69275
|
return;
|
|
69257
69276
|
}
|
|
69258
69277
|
if (!inference.isFixed) {
|
|
@@ -69814,12 +69833,16 @@ function createTypeChecker(host) {
|
|
|
69814
69833
|
function getInferredType(context, index) {
|
|
69815
69834
|
const inference = context.inferences[index];
|
|
69816
69835
|
if (!inference.inferredType) {
|
|
69836
|
+
let isFromBindingPattern = false;
|
|
69817
69837
|
let inferredType;
|
|
69818
69838
|
let fallbackType;
|
|
69819
69839
|
if (context.signature) {
|
|
69820
69840
|
const inferredCovariantType = inference.candidates ? getCovariantInference(inference, context.signature) : void 0;
|
|
69821
69841
|
const inferredContravariantType = inference.contraCandidates ? getContravariantInference(inference) : void 0;
|
|
69822
|
-
if (inferredCovariantType
|
|
69842
|
+
if (inferredCovariantType == null ? void 0 : inferredCovariantType.pattern) {
|
|
69843
|
+
isFromBindingPattern = true;
|
|
69844
|
+
inferredType = inferredCovariantType;
|
|
69845
|
+
} else if (inferredCovariantType || inferredContravariantType) {
|
|
69823
69846
|
const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeSubtypeOf(t, inferredCovariantType))));
|
|
69824
69847
|
inferredType = preferCovariantType ? inferredCovariantType : inferredContravariantType;
|
|
69825
69848
|
fallbackType = preferCovariantType ? inferredContravariantType : inferredCovariantType;
|
|
@@ -69838,7 +69861,9 @@ function createTypeChecker(host) {
|
|
|
69838
69861
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
69839
69862
|
if (constraint) {
|
|
69840
69863
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
69841
|
-
if (
|
|
69864
|
+
if (isFromBindingPattern) {
|
|
69865
|
+
inference.inferredType = getIntersectionType([inference.inferredType, instantiatedConstraint]);
|
|
69866
|
+
} else if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
69842
69867
|
inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
|
|
69843
69868
|
}
|
|
69844
69869
|
}
|
|
@@ -73165,7 +73190,16 @@ function createTypeChecker(host) {
|
|
|
73165
73190
|
} else if (t.flags & 3670016 /* StructuredType */) {
|
|
73166
73191
|
const prop = getPropertyOfType(t, name);
|
|
73167
73192
|
if (prop) {
|
|
73168
|
-
|
|
73193
|
+
if (isCircularMappedProperty(prop)) {
|
|
73194
|
+
return void 0;
|
|
73195
|
+
}
|
|
73196
|
+
const type2 = getTypeOfSymbol(prop);
|
|
73197
|
+
if (type2 !== nonInferrableUnknownType) {
|
|
73198
|
+
return removeMissingType(type2, !!(prop && prop.flags & 16777216 /* Optional */));
|
|
73199
|
+
}
|
|
73200
|
+
if (t.flags & 2097152 /* Intersection */) {
|
|
73201
|
+
t = getIntersectionType(t.types.filter((t2) => !t2.pattern));
|
|
73202
|
+
}
|
|
73169
73203
|
}
|
|
73170
73204
|
if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
|
|
73171
73205
|
const restType = getElementTypeOfSliceOfTupleType(
|
|
@@ -74015,7 +74049,7 @@ function createTypeChecker(host) {
|
|
|
74015
74049
|
/*contextFlags*/
|
|
74016
74050
|
void 0
|
|
74017
74051
|
);
|
|
74018
|
-
const contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 206 /* ObjectBindingPattern */ || contextualType.pattern.kind === 210 /* ObjectLiteralExpression */);
|
|
74052
|
+
const contextualTypeHasPattern = !(checkMode & 2 /* Inferential */) && contextualType && contextualType.pattern && (contextualType.pattern.kind === 206 /* ObjectBindingPattern */ || contextualType.pattern.kind === 210 /* ObjectLiteralExpression */);
|
|
74019
74053
|
const inConstContext = isConstContext(node);
|
|
74020
74054
|
const checkFlags = inConstContext ? 8 /* Readonly */ : 0;
|
|
74021
74055
|
const isInJavascript = isInJSFile(node) && !isInJsonFile(node);
|
|
@@ -78761,7 +78795,7 @@ function createTypeChecker(host) {
|
|
|
78761
78795
|
if (!witnesses) {
|
|
78762
78796
|
return false;
|
|
78763
78797
|
}
|
|
78764
|
-
const operandConstraint =
|
|
78798
|
+
const operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression));
|
|
78765
78799
|
const notEqualFacts = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses);
|
|
78766
78800
|
if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
|
|
78767
78801
|
return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
|
package/lib/typescript.js
CHANGED
|
@@ -46569,7 +46569,6 @@ ${lanes.join("\n")}
|
|
|
46569
46569
|
);
|
|
46570
46570
|
var errorType = createIntrinsicType(1 /* Any */, "error");
|
|
46571
46571
|
var unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
|
|
46572
|
-
var nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */, "non-inferrable");
|
|
46573
46572
|
var intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic");
|
|
46574
46573
|
var unknownType = createIntrinsicType(2 /* Unknown */, "unknown");
|
|
46575
46574
|
var nonNullUnknownType = createIntrinsicType(
|
|
@@ -46579,6 +46578,7 @@ ${lanes.join("\n")}
|
|
|
46579
46578
|
void 0,
|
|
46580
46579
|
"non-null"
|
|
46581
46580
|
);
|
|
46581
|
+
var nonInferrableUnknownType = createIntrinsicType(2 /* Unknown */, "unknown", 65536 /* ContainsWideningType */, "non-inferrable");
|
|
46582
46582
|
var undefinedType = createIntrinsicType(32768 /* Undefined */, "undefined");
|
|
46583
46583
|
var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768 /* Undefined */, "undefined", 65536 /* ContainsWideningType */, "widening");
|
|
46584
46584
|
var missingType = createIntrinsicType(
|
|
@@ -55129,7 +55129,7 @@ ${lanes.join("\n")}
|
|
|
55129
55129
|
if (reportErrors2 && !declarationBelongsToPrivateAmbientMember(element)) {
|
|
55130
55130
|
reportImplicitAny(element, anyType);
|
|
55131
55131
|
}
|
|
55132
|
-
return includePatternInType ?
|
|
55132
|
+
return includePatternInType ? nonInferrableUnknownType : anyType;
|
|
55133
55133
|
}
|
|
55134
55134
|
function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors2) {
|
|
55135
55135
|
const members = createSymbolTable();
|
|
@@ -63135,7 +63135,7 @@ ${lanes.join("\n")}
|
|
|
63135
63135
|
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
|
|
63136
63136
|
const s = source.flags;
|
|
63137
63137
|
const t = target.flags;
|
|
63138
|
-
if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
|
|
63138
|
+
if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType || source === nonInferrableUnknownType)
|
|
63139
63139
|
return true;
|
|
63140
63140
|
if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
|
|
63141
63141
|
return true;
|
|
@@ -66385,6 +66385,9 @@ ${lanes.join("\n")}
|
|
|
66385
66385
|
result = anyType;
|
|
66386
66386
|
} else if (isObjectLiteralType2(type)) {
|
|
66387
66387
|
result = getWidenedTypeOfObjectLiteral(type, context);
|
|
66388
|
+
if (type.pattern) {
|
|
66389
|
+
result.pattern = type.pattern;
|
|
66390
|
+
}
|
|
66388
66391
|
} else if (type.flags & 1048576 /* Union */) {
|
|
66389
66392
|
const unionContext = context || createWideningContext(
|
|
66390
66393
|
/*parent*/
|
|
@@ -66399,6 +66402,9 @@ ${lanes.join("\n")}
|
|
|
66399
66402
|
result = getIntersectionType(sameMap(type.types, getWidenedType));
|
|
66400
66403
|
} else if (isArrayOrTupleType(type)) {
|
|
66401
66404
|
result = createTypeReference(type.target, sameMap(getTypeArguments(type), getWidenedType));
|
|
66405
|
+
if (type.pattern) {
|
|
66406
|
+
result.pattern = type.pattern;
|
|
66407
|
+
}
|
|
66402
66408
|
}
|
|
66403
66409
|
if (result && context === void 0) {
|
|
66404
66410
|
type.widened = result;
|
|
@@ -66732,12 +66738,22 @@ ${lanes.join("\n")}
|
|
|
66732
66738
|
return void 0;
|
|
66733
66739
|
}
|
|
66734
66740
|
if (isArrayType(source)) {
|
|
66735
|
-
|
|
66741
|
+
let reversed2 = createArrayType(inferReverseMappedType(getTypeArguments(source)[0], target, constraint), isReadonlyArrayType(source));
|
|
66742
|
+
if (source.pattern) {
|
|
66743
|
+
reversed2 = cloneTypeReference(reversed2);
|
|
66744
|
+
reversed2.pattern = source.pattern;
|
|
66745
|
+
}
|
|
66746
|
+
return reversed2;
|
|
66736
66747
|
}
|
|
66737
66748
|
if (isTupleType(source)) {
|
|
66738
66749
|
const elementTypes = map(getElementTypes(source), (t) => inferReverseMappedType(t, target, constraint));
|
|
66739
66750
|
const elementFlags = getMappedTypeModifiers(target) & 4 /* IncludeOptional */ ? sameMap(source.target.elementFlags, (f) => f & 2 /* Optional */ ? 1 /* Required */ : f) : source.target.elementFlags;
|
|
66740
|
-
|
|
66751
|
+
let reversed2 = createTupleType(elementTypes, elementFlags, source.target.readonly, source.target.labeledElementDeclarations);
|
|
66752
|
+
if (source.pattern) {
|
|
66753
|
+
reversed2 = cloneTypeReference(reversed2);
|
|
66754
|
+
reversed2.pattern = source.pattern;
|
|
66755
|
+
}
|
|
66756
|
+
return reversed2;
|
|
66741
66757
|
}
|
|
66742
66758
|
const reversed = createObjectType(
|
|
66743
66759
|
1024 /* ReverseMapped */ | 16 /* Anonymous */,
|
|
@@ -66747,6 +66763,9 @@ ${lanes.join("\n")}
|
|
|
66747
66763
|
reversed.source = source;
|
|
66748
66764
|
reversed.mappedType = target;
|
|
66749
66765
|
reversed.constraintType = constraint;
|
|
66766
|
+
if (source.pattern) {
|
|
66767
|
+
reversed.pattern = source.pattern;
|
|
66768
|
+
}
|
|
66750
66769
|
return reversed;
|
|
66751
66770
|
}
|
|
66752
66771
|
function getTypeOfReverseMappedSymbol(symbol) {
|
|
@@ -66761,7 +66780,7 @@ ${lanes.join("\n")}
|
|
|
66761
66780
|
const templateType = getTemplateTypeFromMappedType(target);
|
|
66762
66781
|
const inference = createInferenceInfo(typeParameter);
|
|
66763
66782
|
inferTypes([inference], sourceType, templateType);
|
|
66764
|
-
return getTypeFromInference(inference) || unknownType;
|
|
66783
|
+
return getTypeFromInference(inference) || (sourceType.pattern ? nonInferrableUnknownType : unknownType);
|
|
66765
66784
|
}
|
|
66766
66785
|
function* getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
|
|
66767
66786
|
const properties = getPropertiesOfType(target);
|
|
@@ -66789,7 +66808,7 @@ ${lanes.join("\n")}
|
|
|
66789
66808
|
return firstOrUndefinedIterator(getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties));
|
|
66790
66809
|
}
|
|
66791
66810
|
function tupleTypesDefinitelyUnrelated(source, target) {
|
|
66792
|
-
return !(target.target.combinedFlags & 8 /* Variadic */) && target.target.minLength > source.target.minLength || !target.target.hasRestElement && (source.target.hasRestElement || target.target.fixedLength < source.target.fixedLength);
|
|
66811
|
+
return !source.pattern && (!(target.target.combinedFlags & 8 /* Variadic */) && target.target.minLength > source.target.minLength || !target.target.hasRestElement && (source.target.hasRestElement || target.target.fixedLength < source.target.fixedLength));
|
|
66793
66812
|
}
|
|
66794
66813
|
function typesDefinitelyUnrelated(source, target) {
|
|
66795
66814
|
return isTupleType(source) && isTupleType(target) ? tupleTypesDefinitelyUnrelated(source, target) : !!getUnmatchedProperty(
|
|
@@ -67008,7 +67027,7 @@ ${lanes.join("\n")}
|
|
|
67008
67027
|
}
|
|
67009
67028
|
const inference = getInferenceInfoForType(target);
|
|
67010
67029
|
if (inference) {
|
|
67011
|
-
if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source ===
|
|
67030
|
+
if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source === nonInferrableUnknownType) {
|
|
67012
67031
|
return;
|
|
67013
67032
|
}
|
|
67014
67033
|
if (!inference.isFixed) {
|
|
@@ -67570,12 +67589,16 @@ ${lanes.join("\n")}
|
|
|
67570
67589
|
function getInferredType(context, index) {
|
|
67571
67590
|
const inference = context.inferences[index];
|
|
67572
67591
|
if (!inference.inferredType) {
|
|
67592
|
+
let isFromBindingPattern = false;
|
|
67573
67593
|
let inferredType;
|
|
67574
67594
|
let fallbackType;
|
|
67575
67595
|
if (context.signature) {
|
|
67576
67596
|
const inferredCovariantType = inference.candidates ? getCovariantInference(inference, context.signature) : void 0;
|
|
67577
67597
|
const inferredContravariantType = inference.contraCandidates ? getContravariantInference(inference) : void 0;
|
|
67578
|
-
if (inferredCovariantType
|
|
67598
|
+
if (inferredCovariantType == null ? void 0 : inferredCovariantType.pattern) {
|
|
67599
|
+
isFromBindingPattern = true;
|
|
67600
|
+
inferredType = inferredCovariantType;
|
|
67601
|
+
} else if (inferredCovariantType || inferredContravariantType) {
|
|
67579
67602
|
const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeSubtypeOf(t, inferredCovariantType))));
|
|
67580
67603
|
inferredType = preferCovariantType ? inferredCovariantType : inferredContravariantType;
|
|
67581
67604
|
fallbackType = preferCovariantType ? inferredContravariantType : inferredCovariantType;
|
|
@@ -67594,7 +67617,9 @@ ${lanes.join("\n")}
|
|
|
67594
67617
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
67595
67618
|
if (constraint) {
|
|
67596
67619
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
67597
|
-
if (
|
|
67620
|
+
if (isFromBindingPattern) {
|
|
67621
|
+
inference.inferredType = getIntersectionType([inference.inferredType, instantiatedConstraint]);
|
|
67622
|
+
} else if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
67598
67623
|
inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
|
|
67599
67624
|
}
|
|
67600
67625
|
}
|
|
@@ -70921,7 +70946,16 @@ ${lanes.join("\n")}
|
|
|
70921
70946
|
} else if (t.flags & 3670016 /* StructuredType */) {
|
|
70922
70947
|
const prop = getPropertyOfType(t, name);
|
|
70923
70948
|
if (prop) {
|
|
70924
|
-
|
|
70949
|
+
if (isCircularMappedProperty(prop)) {
|
|
70950
|
+
return void 0;
|
|
70951
|
+
}
|
|
70952
|
+
const type2 = getTypeOfSymbol(prop);
|
|
70953
|
+
if (type2 !== nonInferrableUnknownType) {
|
|
70954
|
+
return removeMissingType(type2, !!(prop && prop.flags & 16777216 /* Optional */));
|
|
70955
|
+
}
|
|
70956
|
+
if (t.flags & 2097152 /* Intersection */) {
|
|
70957
|
+
t = getIntersectionType(t.types.filter((t2) => !t2.pattern));
|
|
70958
|
+
}
|
|
70925
70959
|
}
|
|
70926
70960
|
if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
|
|
70927
70961
|
const restType = getElementTypeOfSliceOfTupleType(
|
|
@@ -71771,7 +71805,7 @@ ${lanes.join("\n")}
|
|
|
71771
71805
|
/*contextFlags*/
|
|
71772
71806
|
void 0
|
|
71773
71807
|
);
|
|
71774
|
-
const contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 206 /* ObjectBindingPattern */ || contextualType.pattern.kind === 210 /* ObjectLiteralExpression */);
|
|
71808
|
+
const contextualTypeHasPattern = !(checkMode & 2 /* Inferential */) && contextualType && contextualType.pattern && (contextualType.pattern.kind === 206 /* ObjectBindingPattern */ || contextualType.pattern.kind === 210 /* ObjectLiteralExpression */);
|
|
71775
71809
|
const inConstContext = isConstContext(node);
|
|
71776
71810
|
const checkFlags = inConstContext ? 8 /* Readonly */ : 0;
|
|
71777
71811
|
const isInJavascript = isInJSFile(node) && !isInJsonFile(node);
|
|
@@ -76517,7 +76551,7 @@ ${lanes.join("\n")}
|
|
|
76517
76551
|
if (!witnesses) {
|
|
76518
76552
|
return false;
|
|
76519
76553
|
}
|
|
76520
|
-
const operandConstraint =
|
|
76554
|
+
const operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression));
|
|
76521
76555
|
const notEqualFacts = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses);
|
|
76522
76556
|
if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
|
|
76523
76557
|
return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
|
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-56875-6",
|
|
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": "22fb10fc0323f3784ea97a775bba60a1eff9bace"
|
|
118
118
|
}
|