Skip to content

Commit 0f90d88

Browse files
committed
Preserve type parameter types in narrowing
1 parent 2305c68 commit 0f90d88

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8682,7 +8682,7 @@ namespace ts {
86828682
// type. Otherwise, the types are completely unrelated, so narrow to an intersection of the
86838683
// two types.
86848684
const targetType = type.flags & TypeFlags.TypeParameter ? getApparentType(type) : type;
8685-
return isTypeSubtypeOf(candidate, targetType) ? candidate :
8685+
return isTypeSubtypeOf(candidate, type) ? candidate :
86868686
isTypeAssignableTo(type, candidate) ? type :
86878687
isTypeAssignableTo(candidate, targetType) ? candidate :
86888688
getIntersectionType([type, candidate]);

0 commit comments

Comments
 (0)