TypeScript/tests/baselines/reference/functionLiteral.types
2015-04-13 14:29:37 -07:00

43 lines
1.7 KiB
Plaintext

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