mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Merge pull request #23067 from Microsoft/fixTPReferenceInConditional
Fix type parameter reference checks in conditional types
This commit is contained in:
@@ -121,3 +121,18 @@ function foo<T>(value: T) {
|
||||
toString2(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Repro from #23052
|
||||
|
||||
type A<T, V, E> =
|
||||
T extends object
|
||||
? { [Q in { [P in keyof T]: T[P] extends V ? P : P; }[keyof T]]: A<T[Q], V, E>; }
|
||||
: T extends V ? T : never;
|
||||
|
||||
type B<T, V> =
|
||||
T extends object
|
||||
? { [Q in { [P in keyof T]: T[P] extends V ? P : P; }[keyof T]]: B<T[Q], V>; }
|
||||
: T extends V ? T : never;
|
||||
|
||||
type C<T, V, E> =
|
||||
{ [Q in { [P in keyof T]: T[P] extends V ? P : P; }[keyof T]]: C<T[Q], V, E>; };
|
||||
|
||||
Reference in New Issue
Block a user