File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -8706,12 +8706,15 @@ namespace ts {
8706
8706
if (constraintType.flags & TypeFlags.Index) {
8707
8707
// We're inferring from some source type S to a homomorphic mapped type { [P in keyof T]: X },
8708
8708
// where T is a type variable. Use inferTypeForHomomorphicMappedType to infer a suitable source
8709
- // type and then infer from that type to T.
8709
+ // type and then make a secondary inference from that type to T. We make a secondary inference
8710
+ // such that direct inferences to T get priority over inferences to Partial<T>, for example.
8710
8711
const index = indexOf(typeVariables, (<IndexType>constraintType).type);
8711
8712
if (index >= 0 && !typeInferences[index].isFixed) {
8712
8713
const inferredType = inferTypeForHomomorphicMappedType(source, <MappedType>target);
8713
8714
if (inferredType) {
8715
+ inferiority++;
8714
8716
inferFromTypes(inferredType, typeVariables[index]);
8717
+ inferiority--;
8715
8718
}
8716
8719
}
8717
8720
return;
You can’t perform that action at this time.
0 commit comments