2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInitializer.ts ===
|
|
|
|
interface I {
|
|
|
|
>I : I
|
|
|
|
|
|
|
|
id: number;
|
|
|
|
>id : number
|
|
|
|
}
|
|
|
|
|
|
|
|
class C implements I {
|
|
|
|
>C : C
|
|
|
|
>I : I
|
|
|
|
|
|
|
|
id: number;
|
|
|
|
>id : number
|
|
|
|
}
|
|
|
|
|
|
|
|
class D<T>{
|
|
|
|
>D : D<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
source: T;
|
|
|
|
>source : T
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
recurse: D<T>;
|
|
|
|
>recurse : D<T>
|
2014-08-19 04:56:03 +02:00
|
|
|
>D : D<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
|
|
|
|
wrapped: D<D<T>>
|
|
|
|
>wrapped : D<D<T>>
|
2014-08-19 04:56:03 +02:00
|
|
|
>D : D<T>
|
|
|
|
>D : D<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
}
|
|
|
|
|
|
|
|
function F(x: string): number { return 42; }
|
2014-08-28 21:52:44 +02:00
|
|
|
>F : (x: string) => number
|
2014-08-15 23:33:16 +02:00
|
|
|
>x : string
|
|
|
|
|
|
|
|
module M {
|
2014-08-28 21:40:58 +02:00
|
|
|
>M : typeof M
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
export class A {
|
|
|
|
>A : A
|
|
|
|
|
|
|
|
name: string;
|
|
|
|
>name : string
|
|
|
|
}
|
|
|
|
|
|
|
|
export function F2(x: number): string { return x.toString(); }
|
2014-08-28 21:52:44 +02:00
|
|
|
>F2 : (x: number) => string
|
2014-08-15 23:33:16 +02:00
|
|
|
>x : number
|
|
|
|
>x.toString() : string
|
|
|
|
>x.toString : (radix?: number) => string
|
|
|
|
>x : number
|
|
|
|
>toString : (radix?: number) => string
|
|
|
|
}
|
|
|
|
|
|
|
|
var aNumber: number = 9.9;
|
|
|
|
>aNumber : number
|
|
|
|
|
|
|
|
var aString: string = 'this is a string';
|
|
|
|
>aString : string
|
|
|
|
|
|
|
|
var aDate: Date = new Date(12);
|
|
|
|
>aDate : Date
|
|
|
|
>Date : Date
|
|
|
|
>new Date(12) : Date
|
2014-10-29 05:21:47 +01:00
|
|
|
>Date : DateConstructor
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var anObject: Object = new Object();
|
|
|
|
>anObject : Object
|
|
|
|
>Object : Object
|
|
|
|
>new Object() : Object
|
2014-10-29 05:21:47 +01:00
|
|
|
>Object : ObjectConstructor
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var anAny: any = null;
|
|
|
|
>anAny : any
|
|
|
|
|
|
|
|
var aSecondAny: any = undefined;
|
|
|
|
>aSecondAny : any
|
|
|
|
>undefined : undefined
|
|
|
|
|
|
|
|
var aVoid: void = undefined;
|
|
|
|
>aVoid : void
|
|
|
|
>undefined : undefined
|
|
|
|
|
|
|
|
var anInterface: I = new C();
|
|
|
|
>anInterface : I
|
|
|
|
>I : I
|
|
|
|
>new C() : C
|
|
|
|
>C : typeof C
|
|
|
|
|
|
|
|
var aClass: C = new C();
|
|
|
|
>aClass : C
|
|
|
|
>C : C
|
|
|
|
>new C() : C
|
|
|
|
>C : typeof C
|
|
|
|
|
|
|
|
var aGenericClass: D<string> = new D<string>();
|
|
|
|
>aGenericClass : D<string>
|
2014-08-19 04:56:03 +02:00
|
|
|
>D : D<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>new D<string>() : D<string>
|
|
|
|
>D : typeof D
|
|
|
|
|
|
|
|
var anObjectLiteral: I = { id: 12 };
|
|
|
|
>anObjectLiteral : I
|
|
|
|
>I : I
|
|
|
|
>{ id: 12 } : { id: number; }
|
|
|
|
>id : number
|
|
|
|
|
|
|
|
var anOtherObjectLiteral: { id: number } = new C();
|
|
|
|
>anOtherObjectLiteral : { id: number; }
|
|
|
|
>id : number
|
|
|
|
>new C() : C
|
|
|
|
>C : typeof C
|
|
|
|
|
|
|
|
var aFunction: typeof F = F;
|
2014-08-28 21:52:44 +02:00
|
|
|
>aFunction : (x: string) => number
|
|
|
|
>F : (x: string) => number
|
|
|
|
>F : (x: string) => number
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var anOtherFunction: (x: string) => number = F;
|
|
|
|
>anOtherFunction : (x: string) => number
|
|
|
|
>x : string
|
2014-08-28 21:52:44 +02:00
|
|
|
>F : (x: string) => number
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var aLambda: typeof F = (x) => 2;
|
2014-08-28 21:52:44 +02:00
|
|
|
>aLambda : (x: string) => number
|
|
|
|
>F : (x: string) => number
|
2014-08-15 23:33:16 +02:00
|
|
|
>(x) => 2 : (x: string) => number
|
|
|
|
>x : string
|
|
|
|
|
|
|
|
var aModule: typeof M = M;
|
|
|
|
>aModule : typeof M
|
|
|
|
>M : typeof M
|
|
|
|
>M : typeof M
|
|
|
|
|
|
|
|
var aClassInModule: M.A = new M.A();
|
2014-08-25 19:36:12 +02:00
|
|
|
>aClassInModule : M.A
|
2014-08-28 21:40:58 +02:00
|
|
|
>M : unknown
|
2014-08-25 19:36:12 +02:00
|
|
|
>A : M.A
|
|
|
|
>new M.A() : M.A
|
|
|
|
>M.A : typeof M.A
|
2014-08-15 23:33:16 +02:00
|
|
|
>M : typeof M
|
2014-08-25 19:36:12 +02:00
|
|
|
>A : typeof M.A
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var aFunctionInModule: typeof M.F2 = (x) => 'this is a string';
|
2014-08-28 21:52:44 +02:00
|
|
|
>aFunctionInModule : (x: number) => string
|
2014-08-15 23:33:16 +02:00
|
|
|
>M : typeof M
|
2014-08-28 21:52:44 +02:00
|
|
|
>F2 : (x: number) => string
|
2014-08-15 23:33:16 +02:00
|
|
|
>(x) => 'this is a string' : (x: number) => string
|
|
|
|
>x : number
|
|
|
|
|
|
|
|
|