165 lines
2.9 KiB
Text
165 lines
2.9 KiB
Text
=== 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>
|
|
>D : D<T>
|
|
>T : T
|
|
|
|
wrapped: D<D<T>>
|
|
>wrapped : D<D<T>>
|
|
>D : D<T>
|
|
>D : D<T>
|
|
>T : T
|
|
}
|
|
|
|
function F(x: string): number { return 42; }
|
|
>F : (x: string) => number
|
|
>x : string
|
|
>42 : number
|
|
|
|
module M {
|
|
>M : typeof M
|
|
|
|
export class A {
|
|
>A : A
|
|
|
|
name: string;
|
|
>name : string
|
|
}
|
|
|
|
export function F2(x: number): string { return x.toString(); }
|
|
>F2 : (x: number) => string
|
|
>x : number
|
|
>x.toString() : string
|
|
>x.toString : (radix?: number) => string
|
|
>x : number
|
|
>toString : (radix?: number) => string
|
|
}
|
|
|
|
var aNumber: number = 9.9;
|
|
>aNumber : number
|
|
>9.9 : number
|
|
|
|
var aString: string = 'this is a string';
|
|
>aString : string
|
|
>'this is a string' : string
|
|
|
|
var aDate: Date = new Date(12);
|
|
>aDate : Date
|
|
>Date : Date
|
|
>new Date(12) : Date
|
|
>Date : DateConstructor
|
|
>12 : number
|
|
|
|
var anObject: Object = new Object();
|
|
>anObject : Object
|
|
>Object : Object
|
|
>new Object() : Object
|
|
>Object : ObjectConstructor
|
|
|
|
var anAny: any = null;
|
|
>anAny : any
|
|
>null : null
|
|
|
|
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>
|
|
>D : D<T>
|
|
>new D<string>() : D<string>
|
|
>D : typeof D
|
|
|
|
var anObjectLiteral: I = { id: 12 };
|
|
>anObjectLiteral : I
|
|
>I : I
|
|
>{ id: 12 } : { id: number; }
|
|
>id : number
|
|
>12 : number
|
|
|
|
var anOtherObjectLiteral: { id: number } = new C();
|
|
>anOtherObjectLiteral : { id: number; }
|
|
>id : number
|
|
>new C() : C
|
|
>C : typeof C
|
|
|
|
var aFunction: typeof F = F;
|
|
>aFunction : (x: string) => number
|
|
>F : (x: string) => number
|
|
>F : (x: string) => number
|
|
|
|
var anOtherFunction: (x: string) => number = F;
|
|
>anOtherFunction : (x: string) => number
|
|
>x : string
|
|
>F : (x: string) => number
|
|
|
|
var aLambda: typeof F = (x) => 2;
|
|
>aLambda : (x: string) => number
|
|
>F : (x: string) => number
|
|
>(x) => 2 : (x: string) => number
|
|
>x : string
|
|
>2 : number
|
|
|
|
var aModule: typeof M = M;
|
|
>aModule : typeof M
|
|
>M : typeof M
|
|
>M : typeof M
|
|
|
|
var aClassInModule: M.A = new M.A();
|
|
>aClassInModule : M.A
|
|
>M : any
|
|
>A : M.A
|
|
>new M.A() : M.A
|
|
>M.A : typeof M.A
|
|
>M : typeof M
|
|
>A : typeof M.A
|
|
|
|
var aFunctionInModule: typeof M.F2 = (x) => 'this is a string';
|
|
>aFunctionInModule : (x: number) => string
|
|
>M.F2 : (x: number) => string
|
|
>M : typeof M
|
|
>F2 : (x: number) => string
|
|
>(x) => 'this is a string' : (x: number) => string
|
|
>x : number
|
|
>'this is a string' : string
|
|
|
|
|