2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/conformance/internalModules/moduleDeclarations/instantiatedModule.ts ===
|
|
|
|
// adding the var makes this an instantiated module
|
|
|
|
|
|
|
|
module M {
|
2014-08-28 21:40:58 +02:00
|
|
|
>M : typeof M
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
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; }
|
2014-08-28 21:40:58 +02:00
|
|
|
>M : unknown
|
2014-08-25 19:36:12 +02:00
|
|
|
>Point : M.Point
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
// making the point a class instead of an interface
|
|
|
|
// makes this an instantiated mmodule
|
|
|
|
module M2 {
|
2014-08-28 21:40:58 +02:00
|
|
|
>M2 : typeof M2
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
export class Point {
|
|
|
|
>Point : Point
|
|
|
|
|
|
|
|
x: number;
|
|
|
|
>x : number
|
|
|
|
|
|
|
|
y: number;
|
|
|
|
>y : number
|
|
|
|
|
|
|
|
static Origin(): Point {
|
2014-08-25 19:36:12 +02:00
|
|
|
>Origin : () => Point
|
2014-08-15 23:33:16 +02:00
|
|
|
>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;
|
2014-08-25 19:36:12 +02:00
|
|
|
>a2 : typeof M2.Point
|
2014-08-15 23:33:16 +02:00
|
|
|
>M2 : typeof M2
|
2014-08-25 19:36:12 +02:00
|
|
|
>Point : typeof M2.Point
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var a2 = m2.Point;
|
2014-08-25 19:36:12 +02:00
|
|
|
>a2 : typeof M2.Point
|
|
|
|
>m2.Point : typeof M2.Point
|
2014-08-15 23:33:16 +02:00
|
|
|
>m2 : typeof M2
|
2014-08-25 19:36:12 +02:00
|
|
|
>Point : typeof M2.Point
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var a2 = M2.Point;
|
2014-08-25 19:36:12 +02:00
|
|
|
>a2 : typeof M2.Point
|
|
|
|
>M2.Point : typeof M2.Point
|
2014-08-15 23:33:16 +02:00
|
|
|
>M2 : typeof M2
|
2014-08-25 19:36:12 +02:00
|
|
|
>Point : typeof M2.Point
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var o: M2.Point = a2.Origin();
|
2014-08-25 19:36:12 +02:00
|
|
|
>o : M2.Point
|
2014-08-28 21:40:58 +02:00
|
|
|
>M2 : unknown
|
2014-08-25 19:36:12 +02:00
|
|
|
>Point : M2.Point
|
|
|
|
>a2.Origin() : M2.Point
|
|
|
|
>a2.Origin : () => M2.Point
|
|
|
|
>a2 : typeof M2.Point
|
|
|
|
>Origin : () => M2.Point
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var p2: { x: number; y: number }
|
|
|
|
>p2 : { x: number; y: number; }
|
|
|
|
>x : number
|
|
|
|
>y : number
|
|
|
|
|
|
|
|
var p2: M2.Point;
|
|
|
|
>p2 : { x: number; y: number; }
|
2014-08-28 21:40:58 +02:00
|
|
|
>M2 : unknown
|
2014-08-25 19:36:12 +02:00
|
|
|
>Point : M2.Point
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var p2 = new m2.Point();
|
|
|
|
>p2 : { x: number; y: number; }
|
2014-08-25 19:36:12 +02:00
|
|
|
>new m2.Point() : M2.Point
|
|
|
|
>m2.Point : typeof M2.Point
|
2014-08-15 23:33:16 +02:00
|
|
|
>m2 : typeof M2
|
2014-08-25 19:36:12 +02:00
|
|
|
>Point : typeof M2.Point
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var p2 = new M2.Point();
|
|
|
|
>p2 : { x: number; y: number; }
|
2014-08-25 19:36:12 +02:00
|
|
|
>new M2.Point() : M2.Point
|
|
|
|
>M2.Point : typeof M2.Point
|
2014-08-15 23:33:16 +02:00
|
|
|
>M2 : typeof M2
|
2014-08-25 19:36:12 +02:00
|
|
|
>Point : typeof M2.Point
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
module M3 {
|
2014-08-28 21:40:58 +02:00
|
|
|
>M3 : typeof M3
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
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;
|
2014-08-25 19:36:12 +02:00
|
|
|
>a3 : typeof M3.Color
|
2014-08-15 23:33:16 +02:00
|
|
|
>M3 : typeof M3
|
2014-08-25 19:36:12 +02:00
|
|
|
>Color : typeof M3.Color
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var a3 = m3.Color;
|
2014-08-25 19:36:12 +02:00
|
|
|
>a3 : typeof M3.Color
|
|
|
|
>m3.Color : typeof M3.Color
|
2014-08-15 23:33:16 +02:00
|
|
|
>m3 : typeof M3
|
2014-08-25 19:36:12 +02:00
|
|
|
>Color : typeof M3.Color
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var a3 = M3.Color;
|
2014-08-25 19:36:12 +02:00
|
|
|
>a3 : typeof M3.Color
|
|
|
|
>M3.Color : typeof M3.Color
|
2014-08-15 23:33:16 +02:00
|
|
|
>M3 : typeof M3
|
2014-08-25 19:36:12 +02:00
|
|
|
>Color : typeof M3.Color
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var blue: M3.Color = a3.Blue;
|
2014-08-25 19:36:12 +02:00
|
|
|
>blue : M3.Color
|
2014-08-28 21:40:58 +02:00
|
|
|
>M3 : unknown
|
2014-08-25 19:36:12 +02:00
|
|
|
>Color : M3.Color
|
|
|
|
>a3.Blue : M3.Color
|
|
|
|
>a3 : typeof M3.Color
|
|
|
|
>Blue : M3.Color
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var p3: M3.Color;
|
2014-08-25 19:36:12 +02:00
|
|
|
>p3 : M3.Color
|
2014-08-28 21:40:58 +02:00
|
|
|
>M3 : unknown
|
2014-08-25 19:36:12 +02:00
|
|
|
>Color : M3.Color
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var p3 = M3.Color.Red;
|
2014-08-25 19:36:12 +02:00
|
|
|
>p3 : M3.Color
|
|
|
|
>M3.Color.Red : M3.Color
|
|
|
|
>M3.Color : typeof M3.Color
|
2014-08-15 23:33:16 +02:00
|
|
|
>M3 : typeof M3
|
2014-08-25 19:36:12 +02:00
|
|
|
>Color : typeof M3.Color
|
|
|
|
>Red : M3.Color
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var p3 = m3.Color.Blue;
|
2014-08-25 19:36:12 +02:00
|
|
|
>p3 : M3.Color
|
|
|
|
>m3.Color.Blue : M3.Color
|
|
|
|
>m3.Color : typeof M3.Color
|
2014-08-15 23:33:16 +02:00
|
|
|
>m3 : typeof M3
|
2014-08-25 19:36:12 +02:00
|
|
|
>Color : typeof M3.Color
|
|
|
|
>Blue : M3.Color
|
2014-08-15 23:33:16 +02:00
|
|
|
|