File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8706,12 +8706,15 @@ namespace ts {
87068706 if (constraintType.flags & TypeFlags.Index) {
87078707 // We're inferring from some source type S to a homomorphic mapped type { [P in keyof T]: X },
87088708 // 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.
87108711 const index = indexOf(typeVariables, (<IndexType>constraintType).type);
87118712 if (index >= 0 && !typeInferences[index].isFixed) {
87128713 const inferredType = inferTypeForHomomorphicMappedType(source, <MappedType>target);
87138714 if (inferredType) {
8715+ inferiority++;
87148716 inferFromTypes(inferredType, typeVariables[index]);
8717+ inferiority--;
87158718 }
87168719 }
87178720 return;
You can’t perform that action at this time.
0 commit comments