Skip to content

Commit 0a28a3e

Browse files
committed
Remove getUnionTypeOfSubtypeConstituents
1 parent 5e94ce6 commit 0a28a3e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3634,10 +3634,6 @@ module ts {
36343634
return type;
36353635
}
36363636

3637-
function getUnionTypeOfSubtypeConstituents(source: UnionType, target: Type): Type {
3638-
return getUnionType(filter(source.types, t => isTypeSubtypeOf(t, target)));
3639-
}
3640-
36413637
function getReducedTypeOfUnionType(type: UnionType): Type {
36423638
// If union type was created without subtype reduction, perform the deferred reduction now
36433639
if (!type.reducedType) {
@@ -5399,7 +5395,7 @@ module ts {
53995395
}
54005396
// If the current type is a union type, remove all constituents that aren't subtypes of the target.
54015397
if (type.flags & TypeFlags.Union) {
5402-
return getUnionTypeOfSubtypeConstituents(<UnionType>type, targetType);
5398+
return getUnionType(filter((<UnionType>type).types, t => isTypeSubtypeOf(t, targetType)));
54035399
}
54045400
}
54055401
}
@@ -5416,7 +5412,7 @@ module ts {
54165412
let instanceType = getUnionType(map(constructSignatures, signature => getReturnTypeOfSignature(getErasedSignature(signature))));
54175413
// Pickup type from union types
54185414
if (type.flags & TypeFlags.Union) {
5419-
return getUnionTypeOfSubtypeConstituents(<UnionType>type, instanceType);
5415+
return getUnionType(filter((<UnionType>type).types, t => isTypeSubtypeOf(t, instanceType)));
54205416
}
54215417
return instanceType;
54225418
}

0 commit comments

Comments
 (0)