1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
=== tests/cases/compiler/typeParameterConstraintInstantiation.ts ===
// Check that type parameter constraints are properly instantiated
interface Mapper<T> {
>Mapper : Mapper<T>
>T : T
map<U extends T, V extends U[]>(f: (item: T) => U): V;
>map : <U extends T, V extends U[]>(f: (item: T) => U) => V
>U : U
>T : T
>V : V
>U : U
>f : (item: T) => U
>item : T
>T : T
>U : U
>V : V
}
var m: Mapper<string>;
>m : Mapper<string>
>Mapper : Mapper<T>
var a = m.map((x: string) => x); // string[]
>a : string[]
>m.map((x: string) => x) : string[]
>m.map : <U extends string, V extends U[]>(f: (item: string) => U) => V
>m : Mapper<string>
>map : <U extends string, V extends U[]>(f: (item: string) => U) => V
>(x: string) => x : (x: string) => string
>x : string
>x : string
|