diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 949af06d121..c8ae32d35a0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -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); }