Merge pull request #23067 from Microsoft/fixTPReferenceInConditional

Fix type parameter reference checks in conditional types
This commit is contained in:
Anders Hejlsberg
2018-04-02 17:30:32 -07:00
committed by GitHub
6 changed files with 233 additions and 6 deletions

View File

@@ -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>; };