File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -8538,9 +8538,10 @@ namespace ts {
85388538 }
85398539 }
85408540 // If the candidate type is a subtype of the target type, narrow to the candidate type.
8541- // Otherwise, narrow to whichever of the target type or the candidate type that is assignable
8542- // to the other. Otherwise, the types are completely unrelated, so narrow to an intersection
8543- // of the two types.
8541+ // Otherwise, if the target type is assignable to the candidate type, keep the target type.
8542+ // Otherwise, if the candidate type is assignable to the target type, narrow to the candidate
8543+ // type. Otherwise, the types are completely unrelated, so narrow to an intersection of the
8544+ // two types.
85448545 const targetType = type.flags & TypeFlags.TypeParameter ? getApparentType(type) : type;
85458546 return isTypeSubtypeOf(candidate, targetType) ? candidate :
85468547 isTypeAssignableTo(type, candidate) ? type :
You can’t perform that action at this time.
0 commit comments