2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/compiler/castTest.ts ===
|
|
|
|
|
|
|
|
var x : any = 0;
|
|
|
|
>x : any
|
|
|
|
|
|
|
|
var z = <number> x;
|
|
|
|
>z : number
|
|
|
|
><number> x : number
|
|
|
|
>x : any
|
|
|
|
|
|
|
|
var y = x + z;
|
|
|
|
>y : any
|
|
|
|
>x + z : any
|
|
|
|
>x : any
|
|
|
|
>z : number
|
|
|
|
|
|
|
|
var a = <any>0;
|
|
|
|
>a : any
|
|
|
|
><any>0 : any
|
|
|
|
|
|
|
|
var b = <boolean>true;
|
|
|
|
>b : boolean
|
|
|
|
><boolean>true : boolean
|
|
|
|
|
|
|
|
var s = <string>"";
|
|
|
|
>s : string
|
|
|
|
><string>"" : string
|
|
|
|
|
|
|
|
var ar = <any[]>null;
|
|
|
|
>ar : any[]
|
|
|
|
><any[]>null : any[]
|
|
|
|
|
|
|
|
var f = <(res : number) => void>null;
|
|
|
|
>f : (res: number) => void
|
|
|
|
><(res : number) => void>null : (res: number) => void
|
|
|
|
>res : number
|
|
|
|
|
|
|
|
declare class Point
|
|
|
|
>Point : Point
|
|
|
|
{
|
|
|
|
x: number;
|
|
|
|
>x : number
|
|
|
|
|
|
|
|
y: number;
|
|
|
|
>y : number
|
|
|
|
|
|
|
|
add(dx: number, dy: number): Point;
|
|
|
|
>add : (dx: number, dy: number) => Point
|
|
|
|
>dx : number
|
|
|
|
>dy : number
|
|
|
|
>Point : Point
|
|
|
|
|
|
|
|
mult(p: Point): Point;
|
|
|
|
>mult : (p: Point) => Point
|
|
|
|
>p : Point
|
|
|
|
>Point : Point
|
|
|
|
>Point : Point
|
|
|
|
|
|
|
|
constructor(x: number, y: number);
|
|
|
|
>x : number
|
|
|
|
>y : number
|
|
|
|
}
|
|
|
|
|
|
|
|
var p_cast = <Point> ({
|
|
|
|
>p_cast : Point
|
2014-08-22 03:39:46 +02:00
|
|
|
><Point> ({ x: 0, y: 0, add: function(dx, dy) { return new Point(this.x + dx, this.y + dy); }, mult: function(p) { return p; }}) : Point
|
2014-08-15 23:33:16 +02:00
|
|
|
>Point : Point
|
2014-08-22 03:39:46 +02:00
|
|
|
>({ x: 0, y: 0, add: function(dx, dy) { return new Point(this.x + dx, this.y + dy); }, mult: function(p) { return p; }}) : { x: number; y: number; add: (dx: any, dy: any) => Point; mult: (p: any) => any; }
|
|
|
|
>{ x: 0, y: 0, add: function(dx, dy) { return new Point(this.x + dx, this.y + dy); }, mult: function(p) { return p; }} : { x: number; y: number; add: (dx: any, dy: any) => Point; mult: (p: any) => any; }
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
x: 0,
|
|
|
|
>x : number
|
|
|
|
|
|
|
|
y: 0,
|
|
|
|
>y : number
|
|
|
|
|
|
|
|
add: function(dx, dy) {
|
|
|
|
>add : (dx: any, dy: any) => Point
|
2014-08-22 03:39:46 +02:00
|
|
|
>function(dx, dy) { return new Point(this.x + dx, this.y + dy); } : (dx: any, dy: any) => Point
|
2014-08-15 23:33:16 +02:00
|
|
|
>dx : any
|
|
|
|
>dy : any
|
|
|
|
|
|
|
|
return new Point(this.x + dx, this.y + dy);
|
|
|
|
>new Point(this.x + dx, this.y + dy) : Point
|
|
|
|
>Point : typeof Point
|
|
|
|
>this.x + dx : any
|
|
|
|
>this.x : any
|
|
|
|
>this : any
|
|
|
|
>x : any
|
|
|
|
>dx : any
|
|
|
|
>this.y + dy : any
|
|
|
|
>this.y : any
|
|
|
|
>this : any
|
|
|
|
>y : any
|
|
|
|
>dy : any
|
|
|
|
|
|
|
|
},
|
|
|
|
mult: function(p) { return p; }
|
|
|
|
>mult : (p: any) => any
|
|
|
|
>function(p) { return p; } : (p: any) => any
|
|
|
|
>p : any
|
|
|
|
>p : any
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|