Skip to content

Commit e46cad8

Browse files
Exempt bare 'boolean's from the check.
1 parent c194abb commit e46cad8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/compiler/checker.ts

+7
Original file line numberDiff line numberDiff line change
@@ -17369,6 +17369,13 @@ namespace ts {
1736917369
}
1737017370

1737117371
function typeCouldHaveTopLevelSingletonTypes(type: Type): boolean {
17372+
// Okay, yes, 'boolean' is a union of 'true | false', but that's not useful
17373+
// in error reporting scenarios. If you need to use this function but that detail matters,
17374+
// feel free to add a flag.
17375+
if (type.flags & TypeFlags.Boolean) {
17376+
return false;
17377+
}
17378+
1737217379
if (type.flags & TypeFlags.UnionOrIntersection) {
1737317380
return !!forEach((type as IntersectionType).types, typeCouldHaveTopLevelSingletonTypes);
1737417381
}

0 commit comments

Comments
 (0)