246 lines
5.2 KiB
Text
246 lines
5.2 KiB
Text
=== tests/cases/compiler/fatarrowfunctions.ts ===
|
|
|
|
function foo(x:any) {
|
|
>foo : (x: any) => any
|
|
>x : any
|
|
|
|
return x();
|
|
>x() : any
|
|
>x : any
|
|
}
|
|
|
|
|
|
foo((x:number,y,z)=>{return x+y+z;});
|
|
>foo((x:number,y,z)=>{return x+y+z;}) : any
|
|
>foo : (x: any) => any
|
|
>(x:number,y,z)=>{return x+y+z;} : (x: number, y: any, z: any) => any
|
|
>x : number
|
|
>y : any
|
|
>z : any
|
|
>x+y+z : any
|
|
>x+y : any
|
|
>x : number
|
|
>y : any
|
|
>z : any
|
|
|
|
foo((x,y,z)=>{return x+y+z;});
|
|
>foo((x,y,z)=>{return x+y+z;}) : any
|
|
>foo : (x: any) => any
|
|
>(x,y,z)=>{return x+y+z;} : (x: any, y: any, z: any) => any
|
|
>x : any
|
|
>y : any
|
|
>z : any
|
|
>x+y+z : any
|
|
>x+y : any
|
|
>x : any
|
|
>y : any
|
|
>z : any
|
|
|
|
foo((x,y:number,z)=>{return x+y+z;});
|
|
>foo((x,y:number,z)=>{return x+y+z;}) : any
|
|
>foo : (x: any) => any
|
|
>(x,y:number,z)=>{return x+y+z;} : (x: any, y: number, z: any) => any
|
|
>x : any
|
|
>y : number
|
|
>z : any
|
|
>x+y+z : any
|
|
>x+y : any
|
|
>x : any
|
|
>y : number
|
|
>z : any
|
|
|
|
foo((x,y:number,z:number)=>{return x+y+z;});
|
|
>foo((x,y:number,z:number)=>{return x+y+z;}) : any
|
|
>foo : (x: any) => any
|
|
>(x,y:number,z:number)=>{return x+y+z;} : (x: any, y: number, z: number) => any
|
|
>x : any
|
|
>y : number
|
|
>z : number
|
|
>x+y+z : any
|
|
>x+y : any
|
|
>x : any
|
|
>y : number
|
|
>z : number
|
|
|
|
foo((x,y,z:number)=>{return x+y+z;});
|
|
>foo((x,y,z:number)=>{return x+y+z;}) : any
|
|
>foo : (x: any) => any
|
|
>(x,y,z:number)=>{return x+y+z;} : (x: any, y: any, z: number) => any
|
|
>x : any
|
|
>y : any
|
|
>z : number
|
|
>x+y+z : any
|
|
>x+y : any
|
|
>x : any
|
|
>y : any
|
|
>z : number
|
|
|
|
foo(()=>{return 0;});
|
|
>foo(()=>{return 0;}) : any
|
|
>foo : (x: any) => any
|
|
>()=>{return 0;} : () => number
|
|
>0 : number
|
|
|
|
foo((x:number,y,z)=>x+y+z);
|
|
>foo((x:number,y,z)=>x+y+z) : any
|
|
>foo : (x: any) => any
|
|
>(x:number,y,z)=>x+y+z : (x: number, y: any, z: any) => any
|
|
>x : number
|
|
>y : any
|
|
>z : any
|
|
>x+y+z : any
|
|
>x+y : any
|
|
>x : number
|
|
>y : any
|
|
>z : any
|
|
|
|
foo((x,y,z)=>x+y+z);
|
|
>foo((x,y,z)=>x+y+z) : any
|
|
>foo : (x: any) => any
|
|
>(x,y,z)=>x+y+z : (x: any, y: any, z: any) => any
|
|
>x : any
|
|
>y : any
|
|
>z : any
|
|
>x+y+z : any
|
|
>x+y : any
|
|
>x : any
|
|
>y : any
|
|
>z : any
|
|
|
|
foo((x,y:number,z)=>{return x+y+z;});
|
|
>foo((x,y:number,z)=>{return x+y+z;}) : any
|
|
>foo : (x: any) => any
|
|
>(x,y:number,z)=>{return x+y+z;} : (x: any, y: number, z: any) => any
|
|
>x : any
|
|
>y : number
|
|
>z : any
|
|
>x+y+z : any
|
|
>x+y : any
|
|
>x : any
|
|
>y : number
|
|
>z : any
|
|
|
|
foo((x,y:number,z:number)=>{return x+y+z;});
|
|
>foo((x,y:number,z:number)=>{return x+y+z;}) : any
|
|
>foo : (x: any) => any
|
|
>(x,y:number,z:number)=>{return x+y+z;} : (x: any, y: number, z: number) => any
|
|
>x : any
|
|
>y : number
|
|
>z : number
|
|
>x+y+z : any
|
|
>x+y : any
|
|
>x : any
|
|
>y : number
|
|
>z : number
|
|
|
|
foo((x,y,z:number)=>{return x+y+z;});
|
|
>foo((x,y,z:number)=>{return x+y+z;}) : any
|
|
>foo : (x: any) => any
|
|
>(x,y,z:number)=>{return x+y+z;} : (x: any, y: any, z: number) => any
|
|
>x : any
|
|
>y : any
|
|
>z : number
|
|
>x+y+z : any
|
|
>x+y : any
|
|
>x : any
|
|
>y : any
|
|
>z : number
|
|
|
|
foo(()=>{return 0;});
|
|
>foo(()=>{return 0;}) : any
|
|
>foo : (x: any) => any
|
|
>()=>{return 0;} : () => number
|
|
>0 : number
|
|
|
|
|
|
foo(((x) => x));
|
|
>foo(((x) => x)) : any
|
|
>foo : (x: any) => any
|
|
>((x) => x) : (x: any) => any
|
|
>(x) => x : (x: any) => any
|
|
>x : any
|
|
>x : any
|
|
|
|
foo(x => x*x);
|
|
>foo(x => x*x) : any
|
|
>foo : (x: any) => any
|
|
>x => x*x : (x: any) => number
|
|
>x : any
|
|
>x*x : number
|
|
>x : any
|
|
>x : any
|
|
|
|
var y = x => x*x;
|
|
>y : (x: any) => number
|
|
>x => x*x : (x: any) => number
|
|
>x : any
|
|
>x*x : number
|
|
>x : any
|
|
>x : any
|
|
|
|
var z = (x:number) => x*x;
|
|
>z : (x: number) => number
|
|
>(x:number) => x*x : (x: number) => number
|
|
>x : number
|
|
>x*x : number
|
|
>x : number
|
|
>x : number
|
|
|
|
var w = () => 3;
|
|
>w : () => number
|
|
>() => 3 : () => number
|
|
>3 : number
|
|
|
|
function ternaryTest(isWhile:boolean) {
|
|
>ternaryTest : (isWhile: boolean) => void
|
|
>isWhile : boolean
|
|
|
|
var f = isWhile ? function (n) { return n > 0; } : function (n) { return n === 0; };
|
|
>f : (n: any) => boolean
|
|
>isWhile ? function (n) { return n > 0; } : function (n) { return n === 0; } : (n: any) => boolean
|
|
>isWhile : boolean
|
|
>function (n) { return n > 0; } : (n: any) => boolean
|
|
>n : any
|
|
>n > 0 : boolean
|
|
>n : any
|
|
>0 : number
|
|
>function (n) { return n === 0; } : (n: any) => boolean
|
|
>n : any
|
|
>n === 0 : boolean
|
|
>n : any
|
|
>0 : number
|
|
|
|
}
|
|
|
|
declare function setTimeout(expression: any, msec?: number, language?: any): number;
|
|
>setTimeout : (expression: any, msec?: number, language?: any) => number
|
|
>expression : any
|
|
>msec : number
|
|
>language : any
|
|
|
|
var messenger = {
|
|
>messenger : { message: string; start: () => void; }
|
|
>{ message: "Hello World", start: function() { setTimeout(() => { this.message.toString(); }, 3000); }} : { message: string; start: () => void; }
|
|
|
|
message: "Hello World",
|
|
>message : string
|
|
>"Hello World" : string
|
|
|
|
start: function() {
|
|
>start : () => void
|
|
>function() { setTimeout(() => { this.message.toString(); }, 3000); } : () => void
|
|
|
|
setTimeout(() => { this.message.toString(); }, 3000);
|
|
>setTimeout(() => { this.message.toString(); }, 3000) : number
|
|
>setTimeout : (expression: any, msec?: number, language?: any) => number
|
|
>() => { this.message.toString(); } : () => void
|
|
>this.message.toString() : any
|
|
>this.message.toString : any
|
|
>this.message : any
|
|
>this : any
|
|
>message : any
|
|
>toString : any
|
|
>3000 : number
|
|
}
|
|
};
|
|
|