@typescript-deploys/pr-build 6.0.0-pr-53017-20 → 6.0.0-pr-56300-12
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 +37 -74
- package/lib/lib.es5.d.ts +0 -9
- package/lib/typescript.js +37 -74
- package/package.json +1 -1
package/lib/_tsc.js
CHANGED
|
@@ -58284,7 +58284,7 @@ function createTypeChecker(host) {
|
|
|
58284
58284
|
const modifiers = getMappedTypeModifiers(type.mappedType);
|
|
58285
58285
|
const readonlyMask = modifiers & 1 /* IncludeReadonly */ ? false : true;
|
|
58286
58286
|
const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
|
|
58287
|
-
const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType)
|
|
58287
|
+
const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType, type.inferenceConstraintType && getIndexedAccessTypeOrUndefined(type.inferenceConstraintType, indexInfo.keyType)) ?? unknownType, readonlyMask && indexInfo.isReadonly)] : emptyArray;
|
|
58288
58288
|
const members = createSymbolTable();
|
|
58289
58289
|
const limitedConstraint = getLimitedConstraint(type);
|
|
58290
58290
|
for (const prop of getPropertiesOfType(type.source)) {
|
|
@@ -58308,6 +58308,7 @@ function createTypeChecker(host) {
|
|
|
58308
58308
|
inferredProp.links.mappedType = type.mappedType;
|
|
58309
58309
|
inferredProp.links.constraintType = type.constraintType;
|
|
58310
58310
|
}
|
|
58311
|
+
inferredProp.links.inferenceConstraintType = type.inferenceConstraintType;
|
|
58311
58312
|
members.set(prop.escapedName, inferredProp);
|
|
58312
58313
|
}
|
|
58313
58314
|
setStructuredTypeMembers(type, members, emptyArray, emptyArray, indexInfos);
|
|
@@ -68153,8 +68154,7 @@ function createTypeChecker(host) {
|
|
|
68153
68154
|
priority: void 0,
|
|
68154
68155
|
topLevel: true,
|
|
68155
68156
|
isFixed: false,
|
|
68156
|
-
impliedArity: void 0
|
|
68157
|
-
indexes: void 0
|
|
68157
|
+
impliedArity: void 0
|
|
68158
68158
|
};
|
|
68159
68159
|
}
|
|
68160
68160
|
function cloneInferenceInfo(inference) {
|
|
@@ -68166,8 +68166,7 @@ function createTypeChecker(host) {
|
|
|
68166
68166
|
priority: inference.priority,
|
|
68167
68167
|
topLevel: inference.topLevel,
|
|
68168
68168
|
isFixed: inference.isFixed,
|
|
68169
|
-
impliedArity: inference.impliedArity
|
|
68170
|
-
indexes: inference.indexes && inference.indexes.slice()
|
|
68169
|
+
impliedArity: inference.impliedArity
|
|
68171
68170
|
};
|
|
68172
68171
|
}
|
|
68173
68172
|
function cloneInferredPartOfContext(context) {
|
|
@@ -68276,19 +68275,20 @@ function createTypeChecker(host) {
|
|
|
68276
68275
|
function getTypeOfReverseMappedSymbol(symbol) {
|
|
68277
68276
|
const links = getSymbolLinks(symbol);
|
|
68278
68277
|
if (!links.type) {
|
|
68279
|
-
|
|
68278
|
+
const reverseConstraint = symbol.links.inferenceConstraintType && getIndexedAccessTypeOrUndefined(symbol.links.inferenceConstraintType, getStringLiteralType(unescapeLeadingUnderscores(symbol.escapedName)));
|
|
68279
|
+
links.type = inferReverseMappedType(symbol.links.propertyType, symbol.links.mappedType, symbol.links.constraintType, reverseConstraint) ?? unknownType;
|
|
68280
68280
|
}
|
|
68281
68281
|
return links.type;
|
|
68282
68282
|
}
|
|
68283
|
-
function inferReverseMappedTypeWorker(sourceType, target, constraint) {
|
|
68283
|
+
function inferReverseMappedTypeWorker(sourceType, target, constraint, reverseMappedConstraint) {
|
|
68284
68284
|
const typeParameter = getIndexedAccessType(constraint.type, getTypeParameterFromMappedType(target));
|
|
68285
68285
|
const templateType = getTemplateTypeFromMappedType(target);
|
|
68286
68286
|
const inference = createInferenceInfo(typeParameter);
|
|
68287
68287
|
inferTypes([inference], sourceType, templateType);
|
|
68288
|
-
return getTypeFromInference(inference)
|
|
68288
|
+
return getTypeFromInference(inference) ?? reverseMappedConstraint ?? unknownType;
|
|
68289
68289
|
}
|
|
68290
|
-
function inferReverseMappedType(source, target, constraint) {
|
|
68291
|
-
const cacheKey = source.id + "," + target.id + "," + constraint.id;
|
|
68290
|
+
function inferReverseMappedType(source, target, constraint, reverseMappedConstraint) {
|
|
68291
|
+
const cacheKey = source.id + "," + target.id + "," + constraint.id + "," + ((reverseMappedConstraint == null ? void 0 : reverseMappedConstraint.id) ?? "0");
|
|
68292
68292
|
if (reverseMappedCache.has(cacheKey)) {
|
|
68293
68293
|
return reverseMappedCache.get(cacheKey) || unknownType;
|
|
68294
68294
|
}
|
|
@@ -68299,7 +68299,7 @@ function createTypeChecker(host) {
|
|
|
68299
68299
|
if (isDeeplyNestedType(target, reverseMappedTargetStack, reverseMappedTargetStack.length, 2)) reverseExpandingFlags |= 2 /* Target */;
|
|
68300
68300
|
let type;
|
|
68301
68301
|
if (reverseExpandingFlags !== 3 /* Both */) {
|
|
68302
|
-
type = inferReverseMappedTypeWorker(source, target, constraint);
|
|
68302
|
+
type = inferReverseMappedTypeWorker(source, target, constraint, reverseMappedConstraint);
|
|
68303
68303
|
}
|
|
68304
68304
|
reverseMappedSourceStack.pop();
|
|
68305
68305
|
reverseMappedTargetStack.pop();
|
|
@@ -68626,24 +68626,6 @@ function createTypeChecker(host) {
|
|
|
68626
68626
|
} else if (source.flags & 8388608 /* IndexedAccess */ && target.flags & 8388608 /* IndexedAccess */) {
|
|
68627
68627
|
inferFromTypes(source.objectType, target.objectType);
|
|
68628
68628
|
inferFromTypes(source.indexType, target.indexType);
|
|
68629
|
-
} else if (!(priority & 1 /* NakedTypeVariable */) && target.flags & 8388608 /* IndexedAccess */) {
|
|
68630
|
-
if (isFromInferenceBlockedSource(source)) {
|
|
68631
|
-
return;
|
|
68632
|
-
}
|
|
68633
|
-
const inference = getInferenceInfoForType(getActualTypeVariable(target.objectType));
|
|
68634
|
-
if (inference) {
|
|
68635
|
-
if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source === nonInferrableAnyType) {
|
|
68636
|
-
return;
|
|
68637
|
-
}
|
|
68638
|
-
if (!inference.isFixed) {
|
|
68639
|
-
const inferenceTypeSymbol = getGlobalSymbol("PartialInference", 788968 /* Type */, Diagnostics.Cannot_find_global_type_0);
|
|
68640
|
-
const inferenceType = inferenceTypeSymbol && getDeclaredTypeOfSymbol(inferenceTypeSymbol);
|
|
68641
|
-
if (inferenceType && inferenceType !== unknownType) {
|
|
68642
|
-
const mapper = createTypeMapper(getSymbolLinks(inferenceTypeSymbol).typeParameters, [source, target.indexType]);
|
|
68643
|
-
inference.indexes = append(inference.indexes, instantiateType(inferenceType, mapper));
|
|
68644
|
-
}
|
|
68645
|
-
}
|
|
68646
|
-
}
|
|
68647
68629
|
} else if (source.flags & 268435456 /* StringMapping */ && target.flags & 268435456 /* StringMapping */) {
|
|
68648
68630
|
if (source.symbol === target.symbol) {
|
|
68649
68631
|
inferFromTypes(source.type, target.type);
|
|
@@ -69147,51 +69129,6 @@ function createTypeChecker(host) {
|
|
|
69147
69129
|
const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & (131072 /* Never */ | 1 /* Any */)) && some(inference.contraCandidates, (t) => isTypeAssignableTo(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeAssignableTo(t, inferredCovariantType))));
|
|
69148
69130
|
inferredType = preferCovariantType ? inferredCovariantType : inferredContravariantType;
|
|
69149
69131
|
fallbackType = preferCovariantType ? inferredContravariantType : inferredCovariantType;
|
|
69150
|
-
} else if (inference.indexes) {
|
|
69151
|
-
let aggregateInference = getIntersectionType(inference.indexes);
|
|
69152
|
-
const constraint2 = getConstraintOfTypeParameter(inference.typeParameter);
|
|
69153
|
-
if (constraint2) {
|
|
69154
|
-
const instantiatedConstraint = instantiateType(constraint2, context.nonFixingMapper);
|
|
69155
|
-
if (instantiatedConstraint.flags & 1048576 /* Union */ && !context.compareTypes(aggregateInference, getTypeWithThisArgument(instantiatedConstraint, aggregateInference))) {
|
|
69156
|
-
const discriminantProps = findDiscriminantProperties(getPropertiesOfType(aggregateInference), instantiatedConstraint);
|
|
69157
|
-
if (discriminantProps) {
|
|
69158
|
-
let match;
|
|
69159
|
-
findDiscriminant:
|
|
69160
|
-
for (const p of discriminantProps) {
|
|
69161
|
-
const candidatePropType = getTypeOfPropertyOfType(aggregateInference, p.escapedName);
|
|
69162
|
-
for (const type of instantiatedConstraint.types) {
|
|
69163
|
-
const propType = getTypeOfPropertyOfType(type, p.escapedName);
|
|
69164
|
-
if (propType && candidatePropType && checkTypeAssignableTo(
|
|
69165
|
-
candidatePropType,
|
|
69166
|
-
propType,
|
|
69167
|
-
/*errorNode*/
|
|
69168
|
-
void 0
|
|
69169
|
-
)) {
|
|
69170
|
-
if (match && match !== type) {
|
|
69171
|
-
match = void 0;
|
|
69172
|
-
break findDiscriminant;
|
|
69173
|
-
} else {
|
|
69174
|
-
match = type;
|
|
69175
|
-
}
|
|
69176
|
-
}
|
|
69177
|
-
}
|
|
69178
|
-
}
|
|
69179
|
-
if (match) {
|
|
69180
|
-
aggregateInference = getSpreadType(
|
|
69181
|
-
match,
|
|
69182
|
-
aggregateInference,
|
|
69183
|
-
/*symbol*/
|
|
69184
|
-
void 0,
|
|
69185
|
-
/*propegatedFlags*/
|
|
69186
|
-
0,
|
|
69187
|
-
/*readonly*/
|
|
69188
|
-
false
|
|
69189
|
-
);
|
|
69190
|
-
}
|
|
69191
|
-
}
|
|
69192
|
-
}
|
|
69193
|
-
}
|
|
69194
|
-
inferredType = aggregateInference;
|
|
69195
69132
|
} else if (context.flags & 1 /* NoDefault */) {
|
|
69196
69133
|
inferredType = silentNeverType;
|
|
69197
69134
|
} else {
|
|
@@ -69207,13 +69144,39 @@ function createTypeChecker(host) {
|
|
|
69207
69144
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
69208
69145
|
if (constraint) {
|
|
69209
69146
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
69147
|
+
inferredType = cloneWithInferenceConstraintIfNeeded(inferredType, instantiatedConstraint);
|
|
69148
|
+
if (inferredType) {
|
|
69149
|
+
inference.inferredType = inferredType;
|
|
69150
|
+
}
|
|
69210
69151
|
if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
69152
|
+
fallbackType = cloneWithInferenceConstraintIfNeeded(fallbackType, instantiatedConstraint);
|
|
69211
69153
|
inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
|
|
69212
69154
|
}
|
|
69213
69155
|
}
|
|
69214
69156
|
clearActiveMapperCaches();
|
|
69215
69157
|
}
|
|
69216
69158
|
return inference.inferredType;
|
|
69159
|
+
function cloneWithInferenceConstraintIfNeeded(type, inferenceConstraintType) {
|
|
69160
|
+
if (!type || !(type.flags & 524288 /* Object */) || !(type.objectFlags & 1024 /* ReverseMapped */)) {
|
|
69161
|
+
return type;
|
|
69162
|
+
}
|
|
69163
|
+
const reversed = type;
|
|
69164
|
+
const cacheKey = reversed.source.id + "," + reversed.mappedType.id + "," + reversed.constraintType.id + "," + inferenceConstraintType.id;
|
|
69165
|
+
if (reverseHomomorphicMappedCache.has(cacheKey)) {
|
|
69166
|
+
return reverseHomomorphicMappedCache.get(cacheKey);
|
|
69167
|
+
}
|
|
69168
|
+
const clone = createObjectType(
|
|
69169
|
+
1024 /* ReverseMapped */ | 16 /* Anonymous */,
|
|
69170
|
+
/*symbol*/
|
|
69171
|
+
void 0
|
|
69172
|
+
);
|
|
69173
|
+
clone.source = reversed.source;
|
|
69174
|
+
clone.mappedType = reversed.mappedType;
|
|
69175
|
+
clone.constraintType = reversed.constraintType;
|
|
69176
|
+
clone.inferenceConstraintType = inferenceConstraintType;
|
|
69177
|
+
reverseHomomorphicMappedCache.set(cacheKey, clone);
|
|
69178
|
+
return clone;
|
|
69179
|
+
}
|
|
69217
69180
|
}
|
|
69218
69181
|
function getDefaultTypeArgumentType(isInJavaScriptFile) {
|
|
69219
69182
|
return isInJavaScriptFile ? anyType : unknownType;
|
package/lib/lib.es5.d.ts
CHANGED
|
@@ -1682,15 +1682,6 @@ type NoInfer<T> = intrinsic;
|
|
|
1682
1682
|
*/
|
|
1683
1683
|
interface ThisType<T> {}
|
|
1684
1684
|
|
|
1685
|
-
/**
|
|
1686
|
-
* Type instantiated to perform partial inferences from indexed accesses
|
|
1687
|
-
*/
|
|
1688
|
-
type PartialInference<T, Keys extends string> = ({
|
|
1689
|
-
[K in Keys]: {
|
|
1690
|
-
[K1 in K]: T;
|
|
1691
|
-
};
|
|
1692
|
-
})[Keys];
|
|
1693
|
-
|
|
1694
1685
|
/**
|
|
1695
1686
|
* Stores types to be used with WeakSet, WeakMap, WeakRef, and FinalizationRegistry
|
|
1696
1687
|
*/
|
package/lib/typescript.js
CHANGED
|
@@ -62912,7 +62912,7 @@ function createTypeChecker(host) {
|
|
|
62912
62912
|
const modifiers = getMappedTypeModifiers(type.mappedType);
|
|
62913
62913
|
const readonlyMask = modifiers & 1 /* IncludeReadonly */ ? false : true;
|
|
62914
62914
|
const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
|
|
62915
|
-
const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType)
|
|
62915
|
+
const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType, type.inferenceConstraintType && getIndexedAccessTypeOrUndefined(type.inferenceConstraintType, indexInfo.keyType)) ?? unknownType, readonlyMask && indexInfo.isReadonly)] : emptyArray;
|
|
62916
62916
|
const members = createSymbolTable();
|
|
62917
62917
|
const limitedConstraint = getLimitedConstraint(type);
|
|
62918
62918
|
for (const prop of getPropertiesOfType(type.source)) {
|
|
@@ -62936,6 +62936,7 @@ function createTypeChecker(host) {
|
|
|
62936
62936
|
inferredProp.links.mappedType = type.mappedType;
|
|
62937
62937
|
inferredProp.links.constraintType = type.constraintType;
|
|
62938
62938
|
}
|
|
62939
|
+
inferredProp.links.inferenceConstraintType = type.inferenceConstraintType;
|
|
62939
62940
|
members.set(prop.escapedName, inferredProp);
|
|
62940
62941
|
}
|
|
62941
62942
|
setStructuredTypeMembers(type, members, emptyArray, emptyArray, indexInfos);
|
|
@@ -72781,8 +72782,7 @@ function createTypeChecker(host) {
|
|
|
72781
72782
|
priority: void 0,
|
|
72782
72783
|
topLevel: true,
|
|
72783
72784
|
isFixed: false,
|
|
72784
|
-
impliedArity: void 0
|
|
72785
|
-
indexes: void 0
|
|
72785
|
+
impliedArity: void 0
|
|
72786
72786
|
};
|
|
72787
72787
|
}
|
|
72788
72788
|
function cloneInferenceInfo(inference) {
|
|
@@ -72794,8 +72794,7 @@ function createTypeChecker(host) {
|
|
|
72794
72794
|
priority: inference.priority,
|
|
72795
72795
|
topLevel: inference.topLevel,
|
|
72796
72796
|
isFixed: inference.isFixed,
|
|
72797
|
-
impliedArity: inference.impliedArity
|
|
72798
|
-
indexes: inference.indexes && inference.indexes.slice()
|
|
72797
|
+
impliedArity: inference.impliedArity
|
|
72799
72798
|
};
|
|
72800
72799
|
}
|
|
72801
72800
|
function cloneInferredPartOfContext(context) {
|
|
@@ -72904,19 +72903,20 @@ function createTypeChecker(host) {
|
|
|
72904
72903
|
function getTypeOfReverseMappedSymbol(symbol) {
|
|
72905
72904
|
const links = getSymbolLinks(symbol);
|
|
72906
72905
|
if (!links.type) {
|
|
72907
|
-
|
|
72906
|
+
const reverseConstraint = symbol.links.inferenceConstraintType && getIndexedAccessTypeOrUndefined(symbol.links.inferenceConstraintType, getStringLiteralType(unescapeLeadingUnderscores(symbol.escapedName)));
|
|
72907
|
+
links.type = inferReverseMappedType(symbol.links.propertyType, symbol.links.mappedType, symbol.links.constraintType, reverseConstraint) ?? unknownType;
|
|
72908
72908
|
}
|
|
72909
72909
|
return links.type;
|
|
72910
72910
|
}
|
|
72911
|
-
function inferReverseMappedTypeWorker(sourceType, target, constraint) {
|
|
72911
|
+
function inferReverseMappedTypeWorker(sourceType, target, constraint, reverseMappedConstraint) {
|
|
72912
72912
|
const typeParameter = getIndexedAccessType(constraint.type, getTypeParameterFromMappedType(target));
|
|
72913
72913
|
const templateType = getTemplateTypeFromMappedType(target);
|
|
72914
72914
|
const inference = createInferenceInfo(typeParameter);
|
|
72915
72915
|
inferTypes([inference], sourceType, templateType);
|
|
72916
|
-
return getTypeFromInference(inference)
|
|
72916
|
+
return getTypeFromInference(inference) ?? reverseMappedConstraint ?? unknownType;
|
|
72917
72917
|
}
|
|
72918
|
-
function inferReverseMappedType(source, target, constraint) {
|
|
72919
|
-
const cacheKey = source.id + "," + target.id + "," + constraint.id;
|
|
72918
|
+
function inferReverseMappedType(source, target, constraint, reverseMappedConstraint) {
|
|
72919
|
+
const cacheKey = source.id + "," + target.id + "," + constraint.id + "," + ((reverseMappedConstraint == null ? void 0 : reverseMappedConstraint.id) ?? "0");
|
|
72920
72920
|
if (reverseMappedCache.has(cacheKey)) {
|
|
72921
72921
|
return reverseMappedCache.get(cacheKey) || unknownType;
|
|
72922
72922
|
}
|
|
@@ -72927,7 +72927,7 @@ function createTypeChecker(host) {
|
|
|
72927
72927
|
if (isDeeplyNestedType(target, reverseMappedTargetStack, reverseMappedTargetStack.length, 2)) reverseExpandingFlags |= 2 /* Target */;
|
|
72928
72928
|
let type;
|
|
72929
72929
|
if (reverseExpandingFlags !== 3 /* Both */) {
|
|
72930
|
-
type = inferReverseMappedTypeWorker(source, target, constraint);
|
|
72930
|
+
type = inferReverseMappedTypeWorker(source, target, constraint, reverseMappedConstraint);
|
|
72931
72931
|
}
|
|
72932
72932
|
reverseMappedSourceStack.pop();
|
|
72933
72933
|
reverseMappedTargetStack.pop();
|
|
@@ -73254,24 +73254,6 @@ function createTypeChecker(host) {
|
|
|
73254
73254
|
} else if (source.flags & 8388608 /* IndexedAccess */ && target.flags & 8388608 /* IndexedAccess */) {
|
|
73255
73255
|
inferFromTypes(source.objectType, target.objectType);
|
|
73256
73256
|
inferFromTypes(source.indexType, target.indexType);
|
|
73257
|
-
} else if (!(priority & 1 /* NakedTypeVariable */) && target.flags & 8388608 /* IndexedAccess */) {
|
|
73258
|
-
if (isFromInferenceBlockedSource(source)) {
|
|
73259
|
-
return;
|
|
73260
|
-
}
|
|
73261
|
-
const inference = getInferenceInfoForType(getActualTypeVariable(target.objectType));
|
|
73262
|
-
if (inference) {
|
|
73263
|
-
if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source === nonInferrableAnyType) {
|
|
73264
|
-
return;
|
|
73265
|
-
}
|
|
73266
|
-
if (!inference.isFixed) {
|
|
73267
|
-
const inferenceTypeSymbol = getGlobalSymbol("PartialInference", 788968 /* Type */, Diagnostics.Cannot_find_global_type_0);
|
|
73268
|
-
const inferenceType = inferenceTypeSymbol && getDeclaredTypeOfSymbol(inferenceTypeSymbol);
|
|
73269
|
-
if (inferenceType && inferenceType !== unknownType) {
|
|
73270
|
-
const mapper = createTypeMapper(getSymbolLinks(inferenceTypeSymbol).typeParameters, [source, target.indexType]);
|
|
73271
|
-
inference.indexes = append(inference.indexes, instantiateType(inferenceType, mapper));
|
|
73272
|
-
}
|
|
73273
|
-
}
|
|
73274
|
-
}
|
|
73275
73257
|
} else if (source.flags & 268435456 /* StringMapping */ && target.flags & 268435456 /* StringMapping */) {
|
|
73276
73258
|
if (source.symbol === target.symbol) {
|
|
73277
73259
|
inferFromTypes(source.type, target.type);
|
|
@@ -73775,51 +73757,6 @@ function createTypeChecker(host) {
|
|
|
73775
73757
|
const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & (131072 /* Never */ | 1 /* Any */)) && some(inference.contraCandidates, (t) => isTypeAssignableTo(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeAssignableTo(t, inferredCovariantType))));
|
|
73776
73758
|
inferredType = preferCovariantType ? inferredCovariantType : inferredContravariantType;
|
|
73777
73759
|
fallbackType = preferCovariantType ? inferredContravariantType : inferredCovariantType;
|
|
73778
|
-
} else if (inference.indexes) {
|
|
73779
|
-
let aggregateInference = getIntersectionType(inference.indexes);
|
|
73780
|
-
const constraint2 = getConstraintOfTypeParameter(inference.typeParameter);
|
|
73781
|
-
if (constraint2) {
|
|
73782
|
-
const instantiatedConstraint = instantiateType(constraint2, context.nonFixingMapper);
|
|
73783
|
-
if (instantiatedConstraint.flags & 1048576 /* Union */ && !context.compareTypes(aggregateInference, getTypeWithThisArgument(instantiatedConstraint, aggregateInference))) {
|
|
73784
|
-
const discriminantProps = findDiscriminantProperties(getPropertiesOfType(aggregateInference), instantiatedConstraint);
|
|
73785
|
-
if (discriminantProps) {
|
|
73786
|
-
let match;
|
|
73787
|
-
findDiscriminant:
|
|
73788
|
-
for (const p of discriminantProps) {
|
|
73789
|
-
const candidatePropType = getTypeOfPropertyOfType(aggregateInference, p.escapedName);
|
|
73790
|
-
for (const type of instantiatedConstraint.types) {
|
|
73791
|
-
const propType = getTypeOfPropertyOfType(type, p.escapedName);
|
|
73792
|
-
if (propType && candidatePropType && checkTypeAssignableTo(
|
|
73793
|
-
candidatePropType,
|
|
73794
|
-
propType,
|
|
73795
|
-
/*errorNode*/
|
|
73796
|
-
void 0
|
|
73797
|
-
)) {
|
|
73798
|
-
if (match && match !== type) {
|
|
73799
|
-
match = void 0;
|
|
73800
|
-
break findDiscriminant;
|
|
73801
|
-
} else {
|
|
73802
|
-
match = type;
|
|
73803
|
-
}
|
|
73804
|
-
}
|
|
73805
|
-
}
|
|
73806
|
-
}
|
|
73807
|
-
if (match) {
|
|
73808
|
-
aggregateInference = getSpreadType(
|
|
73809
|
-
match,
|
|
73810
|
-
aggregateInference,
|
|
73811
|
-
/*symbol*/
|
|
73812
|
-
void 0,
|
|
73813
|
-
/*propegatedFlags*/
|
|
73814
|
-
0,
|
|
73815
|
-
/*readonly*/
|
|
73816
|
-
false
|
|
73817
|
-
);
|
|
73818
|
-
}
|
|
73819
|
-
}
|
|
73820
|
-
}
|
|
73821
|
-
}
|
|
73822
|
-
inferredType = aggregateInference;
|
|
73823
73760
|
} else if (context.flags & 1 /* NoDefault */) {
|
|
73824
73761
|
inferredType = silentNeverType;
|
|
73825
73762
|
} else {
|
|
@@ -73835,13 +73772,39 @@ function createTypeChecker(host) {
|
|
|
73835
73772
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
73836
73773
|
if (constraint) {
|
|
73837
73774
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
73775
|
+
inferredType = cloneWithInferenceConstraintIfNeeded(inferredType, instantiatedConstraint);
|
|
73776
|
+
if (inferredType) {
|
|
73777
|
+
inference.inferredType = inferredType;
|
|
73778
|
+
}
|
|
73838
73779
|
if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
73780
|
+
fallbackType = cloneWithInferenceConstraintIfNeeded(fallbackType, instantiatedConstraint);
|
|
73839
73781
|
inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
|
|
73840
73782
|
}
|
|
73841
73783
|
}
|
|
73842
73784
|
clearActiveMapperCaches();
|
|
73843
73785
|
}
|
|
73844
73786
|
return inference.inferredType;
|
|
73787
|
+
function cloneWithInferenceConstraintIfNeeded(type, inferenceConstraintType) {
|
|
73788
|
+
if (!type || !(type.flags & 524288 /* Object */) || !(type.objectFlags & 1024 /* ReverseMapped */)) {
|
|
73789
|
+
return type;
|
|
73790
|
+
}
|
|
73791
|
+
const reversed = type;
|
|
73792
|
+
const cacheKey = reversed.source.id + "," + reversed.mappedType.id + "," + reversed.constraintType.id + "," + inferenceConstraintType.id;
|
|
73793
|
+
if (reverseHomomorphicMappedCache.has(cacheKey)) {
|
|
73794
|
+
return reverseHomomorphicMappedCache.get(cacheKey);
|
|
73795
|
+
}
|
|
73796
|
+
const clone2 = createObjectType(
|
|
73797
|
+
1024 /* ReverseMapped */ | 16 /* Anonymous */,
|
|
73798
|
+
/*symbol*/
|
|
73799
|
+
void 0
|
|
73800
|
+
);
|
|
73801
|
+
clone2.source = reversed.source;
|
|
73802
|
+
clone2.mappedType = reversed.mappedType;
|
|
73803
|
+
clone2.constraintType = reversed.constraintType;
|
|
73804
|
+
clone2.inferenceConstraintType = inferenceConstraintType;
|
|
73805
|
+
reverseHomomorphicMappedCache.set(cacheKey, clone2);
|
|
73806
|
+
return clone2;
|
|
73807
|
+
}
|
|
73845
73808
|
}
|
|
73846
73809
|
function getDefaultTypeArgumentType(isInJavaScriptFile) {
|
|
73847
73810
|
return isInJavaScriptFile ? anyType : unknownType;
|
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": "6.0.0-pr-
|
|
5
|
+
"version": "6.0.0-pr-56300-12",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|