Handle intersection types in getWidenedType

This commit is contained in:
Anders Hejlsberg
2018-12-18 11:50:29 -08:00
parent c5ee5ea7f2
commit 67491414f1

View File

@@ -13597,6 +13597,9 @@ namespace ts {
// union includes empty object types (e.g. reducing {} | string to just {}).
return getUnionType(widenedTypes, some(widenedTypes, isEmptyObjectType) ? UnionReduction.Subtype : UnionReduction.Literal);
}
if (type.flags & TypeFlags.Intersection) {
return getIntersectionType(sameMap((<IntersectionType>type).types, getWidenedType));
}
if (isArrayType(type) || isTupleType(type)) {
return createTypeReference((<TypeReference>type).target, sameMap((<TypeReference>type).typeArguments, getWidenedType));
}