24 lines
629 B
Text
24 lines
629 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[]
|
|
>1 : number
|
|
>2 : number
|
|
>3 : number
|
|
>map : <U>(callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[]
|
|
>identity : <A>(a: A) => A
|
|
>0 : number
|
|
|