TypeScript/tests/baselines/reference/conditionalTypeSubclassExtendsTypeParam.types
Wesley Wigham 2643e65da4
Add missing relationship allowing a type to be assignable to a conditional when assignable to both branches (#30639)
* Finally add that missing relationship allowing a type to be assignable to both branches of a conditional

* Explicitly write out Ternary.Maybe

* Add slightly modified example from #25413

* fix sick sentence

* Loosen check to skip false branch constraint check to consider `infer` parameters as always satisfied in the extends clause

* Simplify things a bit, only instantiate once

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-03-11 11:56:55 -08:00

12 lines
407 B
Plaintext

=== tests/cases/compiler/conditionalTypeSubclassExtendsTypeParam.ts ===
declare class Model<M extends MR, MR extends {}> {
>Model : Model<M, MR>
public getField2<K extends keyof M>(): Field<M[K], [K] extends [keyof MR] ? MR[K] : M[K]>
>getField2 : <K extends keyof M>() => Field<M[K], [K] extends [keyof MR] ? MR[K] : M[K]>
}
declare class Field<T extends TR, TR> {
>Field : Field<T, TR>
}