1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
|
=== 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 }
>x : number
>y : number
export var Point = 1;
>Point : number
>1 : 1
}
// 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 : any
// 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
return { x: 0, y: 0 };
>{ x: 0, y: 0 } : { x: number; y: number; }
>x : number
>0 : 0
>y : number
>0 : 0
}
}
}
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 M2.Point
>M2.Point : typeof M2.Point
>M2 : typeof M2
>Point : typeof M2.Point
var a2 = m2.Point;
>a2 : typeof M2.Point
>m2.Point : typeof M2.Point
>m2 : typeof M2
>Point : typeof M2.Point
var a2 = M2.Point;
>a2 : typeof M2.Point
>M2.Point : typeof M2.Point
>M2 : typeof M2
>Point : typeof M2.Point
var o: M2.Point = a2.Origin();
>o : M2.Point
>M2 : any
>a2.Origin() : M2.Point
>a2.Origin : () => M2.Point
>a2 : typeof M2.Point
>Origin : () => M2.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 : any
var p2 = new m2.Point();
>p2 : { x: number; y: number; }
>new m2.Point() : M2.Point
>m2.Point : typeof M2.Point
>m2 : typeof M2
>Point : typeof M2.Point
var p2 = new M2.Point();
>p2 : { x: number; y: number; }
>new M2.Point() : M2.Point
>M2.Point : typeof M2.Point
>M2 : typeof M2
>Point : typeof M2.Point
module M3 {
>M3 : typeof M3
export enum Color { Blue, Red }
>Color : Color
>Blue : Color.Blue
>Red : Color.Red
}
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 M3.Color
>M3.Color : typeof M3.Color
>M3 : typeof M3
>Color : typeof M3.Color
var a3 = m3.Color;
>a3 : typeof M3.Color
>m3.Color : typeof M3.Color
>m3 : typeof M3
>Color : typeof M3.Color
var a3 = M3.Color;
>a3 : typeof M3.Color
>M3.Color : typeof M3.Color
>M3 : typeof M3
>Color : typeof M3.Color
var blue: M3.Color = a3.Blue;
>blue : M3.Color
>M3 : any
>a3.Blue : M3.Color.Blue
>a3 : typeof M3.Color
>Blue : M3.Color.Blue
var p3: M3.Color;
>p3 : M3.Color
>M3 : any
var p3 = M3.Color.Red;
>p3 : M3.Color
>M3.Color.Red : M3.Color.Red
>M3.Color : typeof M3.Color
>M3 : typeof M3
>Color : typeof M3.Color
>Red : M3.Color.Red
var p3 = m3.Color.Blue;
>p3 : M3.Color
>m3.Color.Blue : M3.Color.Blue
>m3.Color : typeof M3.Color
>m3 : typeof M3
>Color : typeof M3.Color
>Blue : M3.Color.Blue
|