Skip to content

Commit 709b4eb

Browse files
ahejlsbergmhegazy
authored andcommitted
Preserve type parameter types in narrowing
1 parent 5c16cb6 commit 709b4eb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8665,7 +8665,7 @@ namespace ts {
86658665
// type. Otherwise, the types are completely unrelated, so narrow to an intersection of the
86668666
// two types.
86678667
const targetType = type.flags & TypeFlags.TypeParameter ? getApparentType(type) : type;
8668-
return isTypeSubtypeOf(candidate, targetType) ? candidate :
8668+
return isTypeSubtypeOf(candidate, type) ? candidate :
86698669
isTypeAssignableTo(type, candidate) ? type :
86708670
isTypeAssignableTo(candidate, targetType) ? candidate :
86718671
getIntersectionType([type, candidate]);

0 commit comments

Comments
 (0)