diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cebbe9380e3..52a9d6db1e7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4877,11 +4877,17 @@ namespace ts { // Note that the "each" checks must precede the "some" checks to produce the correct results if (source.flags & TypeFlags.Union) { + if (relation === comparableRelation && (result = someTypeRelatedToType(source as UnionType, target, reportErrors))) { + return result; + } if (result = eachTypeRelatedToType(source, target, reportErrors)) { return result; } } else if (target.flags & TypeFlags.Intersection) { + if (relation === comparableRelation && (result = typeRelatedToSomeType(source, target as IntersectionType, reportErrors))) { + return result; + } if (result = typeRelatedToEachType(source, target, reportErrors)) { return result; }