Skip to content

Commit 583ca83

Browse files
committed
Exclude intersections containing non-inferrable types
1 parent 37d539d commit 583ca83

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15363,7 +15363,7 @@ namespace ts {
1536315363
//
1536415364
// - For a primitive type or type parameter (such as 'number = A & B') there is no point in
1536515365
// breaking the intersection apart.
15366-
if (!isNonGenericObjectType(target) || !every((<IntersectionType>source).types, isNonGenericObjectType)) {
15366+
if (!isNonGenericObjectType(target) || !every((<IntersectionType>source).types, t => isNonGenericObjectType(t) && !(getObjectFlags(t) & ObjectFlags.NonInferrableType))) {
1536715367
result = someTypeRelatedToType(<IntersectionType>source, target, /*reportErrors*/ false, IntersectionState.Source);
1536815368
}
1536915369
}

0 commit comments

Comments
 (0)