Preserve type parameter types in narrowing
This commit is contained in:
parent
5c16cb6f32
commit
709b4ebc83
1 changed files with 1 additions and 1 deletions
|
@ -8665,7 +8665,7 @@ namespace ts {
|
|||
// type. Otherwise, the types are completely unrelated, so narrow to an intersection of the
|
||||
// two types.
|
||||
const targetType = type.flags & TypeFlags.TypeParameter ? getApparentType(type) : type;
|
||||
return isTypeSubtypeOf(candidate, targetType) ? candidate :
|
||||
return isTypeSubtypeOf(candidate, type) ? candidate :
|
||||
isTypeAssignableTo(type, candidate) ? type :
|
||||
isTypeAssignableTo(candidate, targetType) ? candidate :
|
||||
getIntersectionType([type, candidate]);
|
||||
|
|
Loading…
Reference in a new issue