TypeScript/tests/baselines/reference/instantiatedModule.types
2014-08-15 14:37:48 -07:00

198 lines
3.3 KiB
Plaintext

=== tests/cases/conformance/internalModules/moduleDeclarations/instantiatedModule.ts ===
// adding the var makes this an instantiated module
module M {
>M : typeof M
export interface Point { x: number; y: number }
>Point : Point
>x : number
>y : number
export var Point = 1;
>Point : number
}
// primary expression
var m: typeof M;
>m : typeof M
>M : typeof M
var m = M;
>m : typeof M
>M : typeof M
var a1: number;
>a1 : number
var a1 = M.Point;
>a1 : number
>M.Point : number
>M : typeof M
>Point : number
var a1 = m.Point;
>a1 : number
>m.Point : number
>m : typeof M
>Point : number
var p1: { x: number; y: number; }
>p1 : { x: number; y: number; }
>x : number
>y : number
var p1: M.Point;
>p1 : { x: number; y: number; }
>M : M
>Point : Point
// making the point a class instead of an interface
// makes this an instantiated mmodule
module M2 {
>M2 : typeof M2
export class Point {
>Point : Point
x: number;
>x : number
y: number;
>y : number
static Origin(): Point {
>Origin : () => Point
>Point : Point
return { x: 0, y: 0 };
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>y : number
}
}
}
var m2: typeof M2;
>m2 : typeof M2
>M2 : typeof M2
var m2 = M2;
>m2 : typeof M2
>M2 : typeof M2
// static side of the class
var a2: typeof M2.Point;
>a2 : typeof Point
>M2 : typeof M2
>Point : typeof Point
var a2 = m2.Point;
>a2 : typeof Point
>m2.Point : typeof Point
>m2 : typeof M2
>Point : typeof Point
var a2 = M2.Point;
>a2 : typeof Point
>M2.Point : typeof Point
>M2 : typeof M2
>Point : typeof Point
var o: M2.Point = a2.Origin();
>o : Point
>M2 : M2
>Point : Point
>a2.Origin() : Point
>a2.Origin : () => Point
>a2 : typeof Point
>Origin : () => Point
var p2: { x: number; y: number }
>p2 : { x: number; y: number; }
>x : number
>y : number
var p2: M2.Point;
>p2 : { x: number; y: number; }
>M2 : M2
>Point : Point
var p2 = new m2.Point();
>p2 : { x: number; y: number; }
>new m2.Point() : Point
>m2.Point : typeof Point
>m2 : typeof M2
>Point : typeof Point
var p2 = new M2.Point();
>p2 : { x: number; y: number; }
>new M2.Point() : Point
>M2.Point : typeof Point
>M2 : typeof M2
>Point : typeof Point
module M3 {
>M3 : typeof M3
export enum Color { Blue, Red }
>Color : Color
>Blue : Color
>Red : Color
}
var m3: typeof M3;
>m3 : typeof M3
>M3 : typeof M3
var m3 = M3;
>m3 : typeof M3
>M3 : typeof M3
var a3: typeof M3.Color;
>a3 : typeof Color
>M3 : typeof M3
>Color : typeof Color
var a3 = m3.Color;
>a3 : typeof Color
>m3.Color : typeof Color
>m3 : typeof M3
>Color : typeof Color
var a3 = M3.Color;
>a3 : typeof Color
>M3.Color : typeof Color
>M3 : typeof M3
>Color : typeof Color
var blue: M3.Color = a3.Blue;
>blue : Color
>M3 : M3
>Color : Color
>a3.Blue : Color
>a3 : typeof Color
>Blue : Color
var p3: M3.Color;
>p3 : Color
>M3 : M3
>Color : Color
var p3 = M3.Color.Red;
>p3 : Color
>M3.Color.Red : Color
>M3.Color : typeof Color
>M3 : typeof M3
>Color : typeof Color
>Red : Color
var p3 = m3.Color.Blue;
>p3 : Color
>m3.Color.Blue : Color
>m3.Color : typeof Color
>m3 : typeof M3
>Color : typeof Color
>Blue : Color