Skip to content

Commit a0c5608

Browse files
committed
Update comment
1 parent 67b3fe5 commit a0c5608

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff 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 :

0 commit comments

Comments
 (0)