If I have this TypeScript code:
module Foo
{
var x : string ="value";
module Bar
{
export var x = x;
}
}
It compiles to the following JavaScript:
var Foo;
(function (Foo) {
var x = "value";
var Bar;
(function (Bar) {
Bar.x = Bar.x;
})(Bar || (Bar = {}));
})(Foo || (Foo = {}));
The problem is the line that says Bar.x = Bar.x. How can I set Bar.x to Foo.x? Is it required to export Foo.x so I can say Bar.x = Foo.x?
It is definitely possible if you remove the ambiguity in the naming: