2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/compiler/vardecl.ts ===
|
|
|
|
var simpleVar;
|
|
|
|
>simpleVar : any
|
|
|
|
|
|
|
|
var anotherVar: any;
|
|
|
|
>anotherVar : any
|
|
|
|
|
|
|
|
var varWithSimpleType: number;
|
|
|
|
>varWithSimpleType : number
|
|
|
|
|
|
|
|
var varWithArrayType: number[];
|
|
|
|
>varWithArrayType : number[]
|
|
|
|
|
|
|
|
var varWithInitialValue = 30;
|
|
|
|
>varWithInitialValue : number
|
|
|
|
|
|
|
|
var withComplicatedValue = { x: 30, y: 70, desc: "position" };
|
|
|
|
>withComplicatedValue : { x: number; y: number; desc: string; }
|
|
|
|
>{ x: 30, y: 70, desc: "position" } : { x: number; y: number; desc: string; }
|
|
|
|
>x : number
|
|
|
|
>y : number
|
|
|
|
>desc : string
|
|
|
|
|
|
|
|
declare var declaredVar;
|
|
|
|
>declaredVar : any
|
|
|
|
|
|
|
|
declare var declareVar2
|
|
|
|
>declareVar2 : any
|
|
|
|
|
|
|
|
declare var declaredVar3;
|
|
|
|
>declaredVar3 : any
|
|
|
|
|
|
|
|
declare var deckareVarWithType: number;
|
|
|
|
>deckareVarWithType : number
|
|
|
|
|
|
|
|
var arrayVar: string[] = ['a', 'b'];
|
|
|
|
>arrayVar : string[]
|
|
|
|
>['a', 'b'] : string[]
|
|
|
|
|
|
|
|
var complicatedArrayVar: { x: number; y: string; }[] ;
|
|
|
|
>complicatedArrayVar : { x: number; y: string; }[]
|
|
|
|
>x : number
|
|
|
|
>y : string
|
|
|
|
|
|
|
|
complicatedArrayVar.push({ x: 30, y : 'hello world' });
|
|
|
|
>complicatedArrayVar.push({ x: 30, y : 'hello world' }) : number
|
|
|
|
>complicatedArrayVar.push : (...items: { x: number; y: string; }[]) => number
|
|
|
|
>complicatedArrayVar : { x: number; y: string; }[]
|
|
|
|
>push : (...items: { x: number; y: string; }[]) => number
|
|
|
|
>{ x: 30, y : 'hello world' } : { x: number; y: string; }
|
|
|
|
>x : number
|
|
|
|
>y : string
|
|
|
|
|
|
|
|
var n1: { [s: string]: number; };
|
2014-12-06 01:58:49 +01:00
|
|
|
>n1 : { [s: string]: number; }
|
2014-08-15 23:33:16 +02:00
|
|
|
>s : string
|
|
|
|
|
|
|
|
var c : {
|
|
|
|
>c : { new?(): any; }
|
|
|
|
|
|
|
|
new? (): any;
|
|
|
|
>new : () => any
|
|
|
|
}
|
|
|
|
|
|
|
|
var d: {
|
|
|
|
>d : { foo?(): { x: number; }; }
|
|
|
|
|
|
|
|
foo? (): {
|
|
|
|
>foo : () => { x: number; }
|
|
|
|
|
|
|
|
x: number;
|
|
|
|
>x : number
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
var d3: {
|
|
|
|
>d3 : { foo(): { x: number; y: number; }; }
|
|
|
|
|
|
|
|
foo(): {
|
|
|
|
>foo : () => { x: number; y: number; }
|
|
|
|
|
|
|
|
x: number;
|
|
|
|
>x : number
|
|
|
|
|
|
|
|
y: number;
|
|
|
|
>y : number
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
var d2: {
|
|
|
|
>d2 : { foo(): { x: number; }; }
|
|
|
|
|
|
|
|
foo (): {
|
|
|
|
>foo : () => { x: number; }
|
|
|
|
|
|
|
|
x: number;
|
|
|
|
>x : number
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
var n2: {
|
|
|
|
>n2 : () => void
|
|
|
|
|
|
|
|
(): void;
|
|
|
|
}
|
|
|
|
var n4: {
|
2014-10-18 01:53:18 +02:00
|
|
|
>n4 : (() => void)[]
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
(): void;
|
|
|
|
}[];
|
|
|
|
|
|
|
|
var d4: {
|
|
|
|
>d4 : { foo(n: string, x: { x: number; y: number; }): { x: number; y: number; }; }
|
|
|
|
|
|
|
|
foo(n: string, x: { x: number; y: number; }): {
|
|
|
|
>foo : (n: string, x: { x: number; y: number; }) => { x: number; y: number; }
|
|
|
|
>n : string
|
|
|
|
>x : { x: number; y: number; }
|
|
|
|
>x : number
|
|
|
|
>y : number
|
|
|
|
|
|
|
|
x: number;
|
|
|
|
>x : number
|
|
|
|
|
|
|
|
y: number;
|
|
|
|
>y : number
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
module m2 {
|
|
|
|
>m2 : typeof m2
|
|
|
|
|
|
|
|
export var a, b2: number = 10, b;
|
|
|
|
>a : any
|
|
|
|
>b2 : number
|
|
|
|
>b : any
|
|
|
|
|
|
|
|
var m1;
|
|
|
|
>m1 : any
|
|
|
|
|
|
|
|
var a2, b22: number = 10, b222;
|
|
|
|
>a2 : any
|
|
|
|
>b22 : number
|
|
|
|
>b222 : any
|
|
|
|
|
|
|
|
var m3;
|
|
|
|
>m3 : any
|
|
|
|
|
|
|
|
class C {
|
|
|
|
>C : C
|
|
|
|
|
|
|
|
constructor (public b) {
|
|
|
|
>b : any
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class C2 {
|
|
|
|
>C2 : C2
|
|
|
|
|
|
|
|
constructor (public b) {
|
|
|
|
>b : any
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var m;
|
|
|
|
>m : any
|
|
|
|
|
|
|
|
declare var d1, d2;
|
|
|
|
>d1 : any
|
|
|
|
>d2 : any
|
|
|
|
|
|
|
|
var b23;
|
|
|
|
>b23 : any
|
|
|
|
|
|
|
|
declare var v1;
|
|
|
|
>v1 : any
|
|
|
|
|
|
|
|
export var mE;
|
|
|
|
>mE : any
|
|
|
|
|
|
|
|
export declare var d1E, d2E;
|
|
|
|
>d1E : any
|
|
|
|
>d2E : any
|
|
|
|
|
|
|
|
export var b2E;
|
|
|
|
>b2E : any
|
|
|
|
|
|
|
|
export declare var v1E;
|
|
|
|
>v1E : any
|
|
|
|
}
|
|
|
|
|
|
|
|
var a22, b22 = 10, c22 = 30;
|
|
|
|
>a22 : any
|
|
|
|
>b22 : number
|
|
|
|
>c22 : number
|
|
|
|
|
|
|
|
var nn;
|
|
|
|
>nn : any
|
|
|
|
|
|
|
|
declare var da1, da2;
|
|
|
|
>da1 : any
|
|
|
|
>da2 : any
|
|
|
|
|
|
|
|
var normalVar;
|
|
|
|
>normalVar : any
|
|
|
|
|
|
|
|
declare var dv1;
|
|
|
|
>dv1 : any
|
|
|
|
|
|
|
|
var xl;
|
|
|
|
>xl : any
|
|
|
|
|
|
|
|
var x;
|
|
|
|
>x : any
|
|
|
|
|
|
|
|
var z;
|
|
|
|
>z : any
|
|
|
|
|
|
|
|
function foo(a2) {
|
|
|
|
>foo : (a2: any) => void
|
|
|
|
>a2 : any
|
|
|
|
|
|
|
|
var a = 10;
|
|
|
|
>a : number
|
|
|
|
}
|
|
|
|
|
|
|
|
for (var i = 0, j = 0; i < 10; i++) {
|
|
|
|
>i : number
|
|
|
|
>j : number
|
|
|
|
>i < 10 : boolean
|
|
|
|
>i : number
|
|
|
|
>i++ : number
|
|
|
|
>i : number
|
|
|
|
|
|
|
|
j++;
|
|
|
|
>j++ : number
|
|
|
|
>j : number
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (var k = 0; k < 30; k++) {
|
|
|
|
>k : number
|
|
|
|
>k < 30 : boolean
|
|
|
|
>k : number
|
|
|
|
>k++ : number
|
|
|
|
>k : number
|
|
|
|
|
|
|
|
k++;
|
|
|
|
>k++ : number
|
|
|
|
>k : number
|
|
|
|
}
|
|
|
|
var b = 10;
|
|
|
|
>b : number
|
|
|
|
|