Skip to content

Commit ef40ed1

Browse files
Exempt bare 'boolean's from the check.
1 parent 619658b commit ef40ed1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/compiler/checker.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17833,6 +17833,13 @@ namespace ts {
1783317833
}
1783417834

1783517835
function typeCouldHaveTopLevelSingletonTypes(type: Type): boolean {
17836+
// Okay, yes, 'boolean' is a union of 'true | false', but that's not useful
17837+
// in error reporting scenarios. If you need to use this function but that detail matters,
17838+
// feel free to add a flag.
17839+
if (type.flags & TypeFlags.Boolean) {
17840+
return false;
17841+
}
17842+
1783617843
if (type.flags & TypeFlags.UnionOrIntersection) {
1783717844
return !!forEach((type as IntersectionType).types, typeCouldHaveTopLevelSingletonTypes);
1783817845
}

0 commit comments

Comments
 (0)