Skip to content

Commit d5f32bd

Browse files
committed
Strengthen supertype reduction check to reduce breakage
1 parent cbbbda4 commit d5f32bd

5 files changed

+3
-178
lines changed

src/compiler/checker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11181,7 +11181,7 @@ namespace ts {
1118111181
}
1118211182
else {
1118311183
const sub = instantiateType((<SubstitutionType>type).substitute, mapper);
11184-
if (sub.flags & TypeFlags.AnyOrUnknown || isTypeSubtypeOf(maybeVariable, sub)) {
11184+
if (sub.flags & TypeFlags.AnyOrUnknown || isTypeSubtypeOf(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) {
1118511185
return maybeVariable;
1118611186
}
1118711187
return sub;

tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.errors.txt

-97
This file was deleted.

tests/baselines/reference/circularlyConstrainedMappedTypeContainingConditionalNoInfiniteInstantiationDepth.types

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
7979
>ComponentType : ComponentType<P>
8080

8181
export type Shared<
82-
>Shared : any
82+
>Shared : Shared<InjectedProps, DecorationTargetProps>
8383

8484
InjectedProps,
8585
DecorationTargetProps extends Shared<InjectedProps, DecorationTargetProps>

tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.errors.txt

-78
This file was deleted.

tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
33
>Omit : Pick<T, Exclude<keyof T, K>>
44

55
type Shared< // Circularly self constraining type, defered thanks to mapping
6-
>Shared : any
6+
>Shared : Shared<InjectedProps, DecorationTargetProps>
77

88
InjectedProps,
99
DecorationTargetProps extends Shared<InjectedProps, DecorationTargetProps>

0 commit comments

Comments
 (0)