21 lines
577 B
Text
21 lines
577 B
Text
|
=== tests/cases/compiler/inferentialTypingWithFunctionType2.ts ===
|
||
|
function identity<A>(a: A): A {
|
||
|
>identity : <A>(a: A) => A
|
||
|
>A : A
|
||
|
>a : A
|
||
|
>A : A
|
||
|
>A : A
|
||
|
|
||
|
return a;
|
||
|
>a : A
|
||
|
}
|
||
|
var x = [1, 2, 3].map(identity)[0];
|
||
|
>x : number
|
||
|
>[1, 2, 3].map(identity)[0] : number
|
||
|
>[1, 2, 3].map(identity) : number[]
|
||
|
>[1, 2, 3].map : <U>(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]
|
||
|
>[1, 2, 3] : number[]
|
||
|
>map : <U>(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]
|
||
|
>identity : <A>(a: A) => A
|
||
|
|