Exempt bare 'boolean's from the check.

This commit is contained in:
Daniel 2020-05-26 22:49:10 +00:00 committed by Daniel Rosenwasser
parent 619658bd44
commit ef40ed1ee6

View File

@ -17833,6 +17833,13 @@ namespace ts {
}
function typeCouldHaveTopLevelSingletonTypes(type: Type): boolean {
// Okay, yes, 'boolean' is a union of 'true | false', but that's not useful
// in error reporting scenarios. If you need to use this function but that detail matters,
// feel free to add a flag.
if (type.flags & TypeFlags.Boolean) {
return false;
}
if (type.flags & TypeFlags.UnionOrIntersection) {
return !!forEach((type as IntersectionType).types, typeCouldHaveTopLevelSingletonTypes);
}