Skip to content

Commit 8ff245f

Browse files
committed
Revert structuredTypeRelatedTo change, fix isUnitLikeType
1 parent 4635a5c commit 8ff245f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19679,7 +19679,7 @@ namespace ts {
1967919679
// the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
1968019680
// For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
1968119681
const constraint = getEffectiveConstraintOfIntersection(source.flags & TypeFlags.Intersection ? (source as IntersectionType).types: [source], !!(target.flags & TypeFlags.Union));
19682-
if (constraint && !(constraint.flags & TypeFlags.Never) && everyType(constraint, c => c !== source)) { // Skip comparison if expansion contains the source itself
19682+
if (constraint && everyType(constraint, c => c !== source)) { // Skip comparison if expansion contains the source itself
1968319683
// TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
1968419684
result = isRelatedTo(constraint, target, RecursionFlags.Source, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
1968519685
}
@@ -21626,8 +21626,7 @@ namespace ts {
2162621626
}
2162721627

2162821628
function isUnitLikeType(type: Type): boolean {
21629-
return type.flags & TypeFlags.Intersection ? some((type as IntersectionType).types, isUnitType) :
21630-
!!(type.flags & TypeFlags.Unit);
21629+
return isUnitType(getBaseConstraintOrType(type));
2163121630
}
2163221631

2163321632
function extractUnitType(type: Type) {

0 commit comments

Comments
 (0)