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 35 36 37 38 39
|
=== tests/cases/conformance/types/specifyingTypes/typeLiterals/functionLiteral.ts ===
// basic valid forms of function literals
var x = () => 1;
>x : Symbol(x, Decl(functionLiteral.ts, 2, 3), Decl(functionLiteral.ts, 3, 3))
var x: {
>x : Symbol(x, Decl(functionLiteral.ts, 2, 3), Decl(functionLiteral.ts, 3, 3))
(): number;
}
var y: { (x: string): string; };
>y : Symbol(y, Decl(functionLiteral.ts, 7, 3), Decl(functionLiteral.ts, 8, 3))
>x : Symbol(x, Decl(functionLiteral.ts, 7, 10))
var y: (x: string) => string;
>y : Symbol(y, Decl(functionLiteral.ts, 7, 3), Decl(functionLiteral.ts, 8, 3))
>x : Symbol(x, Decl(functionLiteral.ts, 8, 8))
var y2: { <T>(x: T): T; } = <T>(x: T) => x
>y2 : Symbol(y2, Decl(functionLiteral.ts, 9, 3))
>T : Symbol(T, Decl(functionLiteral.ts, 9, 11))
>x : Symbol(x, Decl(functionLiteral.ts, 9, 14))
>T : Symbol(T, Decl(functionLiteral.ts, 9, 11))
>T : Symbol(T, Decl(functionLiteral.ts, 9, 11))
>T : Symbol(T, Decl(functionLiteral.ts, 9, 29))
>x : Symbol(x, Decl(functionLiteral.ts, 9, 32))
>T : Symbol(T, Decl(functionLiteral.ts, 9, 29))
>x : Symbol(x, Decl(functionLiteral.ts, 9, 32))
var z: { new (x: number): number; };
>z : Symbol(z, Decl(functionLiteral.ts, 11, 3), Decl(functionLiteral.ts, 12, 3))
>x : Symbol(x, Decl(functionLiteral.ts, 11, 14))
var z: new (x: number) => number;
>z : Symbol(z, Decl(functionLiteral.ts, 11, 3), Decl(functionLiteral.ts, 12, 3))
>x : Symbol(x, Decl(functionLiteral.ts, 12, 12))
|