@@ -11823,11 +11823,6 @@ namespace ts {
11823
11823
return hasNonCircularBaseConstraint(type) ? getConstraintFromConditionalType(type) : undefined;
11824
11824
}
11825
11825
11826
- function hasStructuredOrInstantiableConstraint(type: Type) {
11827
- const constraint = type.flags & TypeFlags.Instantiable ? getConstraintOfType(type) : undefined;
11828
- return constraint && !!(constraint.flags & TypeFlags.StructuredOrInstantiable);
11829
- }
11830
-
11831
11826
function isUnionContainingMultipleObjectLikeTypes(type: Type) {
11832
11827
return !!(type.flags & TypeFlags.Union) &&
11833
11828
countWhere((type as UnionType).types, t => !!(t.flags & (TypeFlags.Object | TypeFlags.Intersection | TypeFlags.Substitution))) >= 2;
@@ -18365,10 +18360,10 @@ namespace ts {
18365
18360
// (1) Source is an intersection of object types { a } & { b } and target is an object type { a, b }.
18366
18361
// (2) Source is an object type { a, b: boolean } and target is a union { a, b: true } | { a, b: false }.
18367
18362
// (3) Source is an intersection { a } & { b: boolean } and target is a union { a, b: true } | { a, b: false }.
18368
- // (4) Source is an instantiable type with a union constraint and target is a union.
18363
+ // (4) Source is an instantiable type with a union or intersection constraint and target is a union or intersection .
18369
18364
if (!result && (source.flags & TypeFlags.Intersection && target.flags & TypeFlags.Object ||
18370
- ( source.flags & (TypeFlags.Object | TypeFlags.Intersection) && isUnionContainingMultipleObjectLikeTypes(target) ) ||
18371
- (target .flags & TypeFlags.Union && hasStructuredOrInstantiableConstraint(source)) )) {
18365
+ source.flags & (TypeFlags.Object | TypeFlags.Intersection) && isUnionContainingMultipleObjectLikeTypes(target) ||
18366
+ source .flags & TypeFlags.Instantiable && target.flags & TypeFlags.UnionOrIntersection )) {
18372
18367
if (result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags)) {
18373
18368
resetErrorInfo(saveErrorInfo);
18374
18369
}
0 commit comments