Create intersection types in type guards for unrelated types

This commit is contained in:
Anders Hejlsberg
2016-06-08 10:51:32 -07:00
parent cdf4cded15
commit 83971d0900
+1 -1
View File
@@ -7997,7 +7997,7 @@ namespace ts {
const targetType = type.flags & TypeFlags.TypeParameter ? getApparentType(type) : type;
return isTypeAssignableTo(candidate, targetType) ? candidate :
isTypeAssignableTo(type, candidate) ? type :
neverType;
getIntersectionType([type, candidate]);
}
function narrowTypeByTypePredicate(type: Type, callExpression: CallExpression, assumeTrue: boolean): Type {