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
|
//// [topLevel.ts]
interface IPoint {
x:number;
y:number;
}
class Point implements IPoint {
constructor(public x,public y){}
public move(xo:number,yo:number) {
this.x+=xo;
this.y+=yo;
return this;
}
public toString() {
return ("("+this.x+","+this.y+")");
}
}
var result="";
result+=(new Point(3,4).move(2,2));
module M {
export var origin=new Point(0,0);
}
result+=(M.origin.move(1,1));
//// [topLevel.js]
var Point = /** @class */ (function () {
function Point(x, y) {
this.x = x;
this.y = y;
}
Point.prototype.move = function (xo, yo) {
this.x += xo;
this.y += yo;
return this;
};
Point.prototype.toString = function () {
return ("(" + this.x + "," + this.y + ")");
};
return Point;
}());
var result = "";
result += (new Point(3, 4).move(2, 2));
var M;
(function (M) {
M.origin = new Point(0, 0);
})(M || (M = {}));
result += (M.origin.move(1, 1));
|