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
|
=== tests/cases/compiler/typeParameterConstraintInstantiation.ts ===
// Check that type parameter constraints are properly instantiated
interface Mapper<T> {
>Mapper : Symbol(Mapper, Decl(typeParameterConstraintInstantiation.ts, 0, 0))
>T : Symbol(T, Decl(typeParameterConstraintInstantiation.ts, 2, 17))
map<U extends T, V extends U[]>(f: (item: T) => U): V;
>map : Symbol(Mapper.map, Decl(typeParameterConstraintInstantiation.ts, 2, 21))
>U : Symbol(U, Decl(typeParameterConstraintInstantiation.ts, 3, 8))
>T : Symbol(T, Decl(typeParameterConstraintInstantiation.ts, 2, 17))
>V : Symbol(V, Decl(typeParameterConstraintInstantiation.ts, 3, 20))
>U : Symbol(U, Decl(typeParameterConstraintInstantiation.ts, 3, 8))
>f : Symbol(f, Decl(typeParameterConstraintInstantiation.ts, 3, 36))
>item : Symbol(item, Decl(typeParameterConstraintInstantiation.ts, 3, 40))
>T : Symbol(T, Decl(typeParameterConstraintInstantiation.ts, 2, 17))
>U : Symbol(U, Decl(typeParameterConstraintInstantiation.ts, 3, 8))
>V : Symbol(V, Decl(typeParameterConstraintInstantiation.ts, 3, 20))
}
var m: Mapper<string>;
>m : Symbol(m, Decl(typeParameterConstraintInstantiation.ts, 6, 3))
>Mapper : Symbol(Mapper, Decl(typeParameterConstraintInstantiation.ts, 0, 0))
var a = m.map((x: string) => x); // string[]
>a : Symbol(a, Decl(typeParameterConstraintInstantiation.ts, 7, 3))
>m.map : Symbol(Mapper.map, Decl(typeParameterConstraintInstantiation.ts, 2, 21))
>m : Symbol(m, Decl(typeParameterConstraintInstantiation.ts, 6, 3))
>map : Symbol(Mapper.map, Decl(typeParameterConstraintInstantiation.ts, 2, 21))
>x : Symbol(x, Decl(typeParameterConstraintInstantiation.ts, 7, 15))
>x : Symbol(x, Decl(typeParameterConstraintInstantiation.ts, 7, 15))
|