TypeScript/tests/baselines/reference/ClassAndModuleWithSameNameAndCommonRoot.js
2014-07-12 17:30:19 -07:00

85 lines
1.6 KiB
JavaScript

//// [tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleWithSameNameAndCommonRoot.ts] ////
//// [class.ts]
module X.Y {
export class Point {
constructor(x: number, y: number) {
this.x = x;
this.y = y;
}
x: number;
y: number;
}
}
//// [module.ts]
module X.Y {
export module Point {
export var Origin = new Point(0, 0);
}
}
//// [test.ts]
//var cl: { x: number; y: number; }
var cl = new X.Y.Point(1,1);
var cl = X.Y.Point.Origin; // error not expected here same as bug 83996 ?
//// [simple.ts]
class A {
id: string;
}
module A {
export var Instance = new A();
}
// ensure merging works as expected
var a = A.Instance;
var a = new A();
var a: { id: string };
//// [class.js]
var X;
(function (X) {
(function (Y) {
var Point = (function () {
function Point(x, y) {
this.x = x;
this.y = y;
}
return Point;
})();
Y.Point = Point;
})(X.Y || (X.Y = {}));
var Y = X.Y;
})(X || (X = {}));
//// [module.js]
var X;
(function (X) {
(function (Y) {
(function (Point) {
Point.Origin = new Point(0, 0);
})(Y.Point || (Y.Point = {}));
var Point = Y.Point;
})(X.Y || (X.Y = {}));
var Y = X.Y;
})(X || (X = {}));
//// [test.js]
var cl = new X.Y.Point(1, 1);
var cl = X.Y.Point.Origin;
//// [simple.js]
var A = (function () {
function A() {
}
return A;
})();
var A;
(function (A) {
A.Instance = new A();
})(A || (A = {}));
var a = A.Instance;
var a = new A();
var a;