Make boolean assignable to union types containing both true and false
This commit is contained in:
parent
770f42377d
commit
e900ebf856
1 changed files with 3 additions and 0 deletions
|
@ -6026,6 +6026,9 @@ namespace ts {
|
|||
if (result = typeRelatedToSomeType(source, <UnionType>target, reportErrors && !(source.flags & TypeFlags.Primitive))) {
|
||||
return result;
|
||||
}
|
||||
if (source === booleanType && contains((<UnionType>target).types, trueType) && contains((<UnionType>target).types, falseType)) {
|
||||
return Ternary.True;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue