File tree 1 file changed +5
-10
lines changed 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -24735,20 +24735,15 @@ namespace ts {
24735
24735
// If the current type is a union type, remove all constituents that couldn't be instances of
24736
24736
// the candidate type. If one or more constituents remain, return a union of those.
24737
24737
if (type.flags & TypeFlags.Union) {
24738
+ let assignableType = filterType(type, t => isRelated(t, candidate));
24738
24739
if(candidate.flags & TypeFlags.Union){
24739
- const assignableType = mapType(type, type => {
24740
- if (!!(type.flags & TypeFlags.String) || !!(type.flags & TypeFlags.Number)) {
24741
- return filterType(candidate, candidate => isTypeSubtypeOf(candidate, type));
24742
- }
24743
- else {
24744
- return isRelated(type, candidate) ? type : neverType;
24745
- }
24740
+ const unionAssignableType = mapType(type, type => {
24741
+ return filterType(candidate, candidate => isRelated(candidate, type));
24746
24742
});
24747
- if (!(assignableType.flags & TypeFlags.Never )) {
24748
- return assignableType;
24743
+ if (!isTypeSubsetOf(unionAssignableType, assignableType )) {
24744
+ assignableType = unionAssignableType ;
24749
24745
}
24750
24746
}
24751
- const assignableType = filterType(type, t => isRelated(t, candidate));
24752
24747
if (!(assignableType.flags & TypeFlags.Never)) {
24753
24748
return assignableType;
24754
24749
}
You can’t perform that action at this time.
0 commit comments