Please see the code below.
module AAA {
export module user {
export var am = {}
}
}
//1.
module AAA {
export module user {
am['x']= 'y';
}
}
//2.
module AAA {
export module user {
user.am['x']= 'y';
}
}
I am trying to split a module into two (or more) files. first (1.) form doesn't work, as the code generated sometimes (couldn't produce in playground) looks like (note the underscore)
var AAA;
(function (AAA) {
(function (_user) {
AAA._user.am['x'] = 'y';
})(AAA.user || (AAA.user = {}));
var user = AAA.user;
})(AAA || (AAA = {}));
but, second (2.) form works fine and I get intellisense for variable am. is this a reliable way, if I guarantee the order of files referenced? or do I need to refer from the root like, AAA.user.am['x']= 'y'; or a better way?
Also, in the generated code, there are two variable declaration var AAA;. Would this cause any issue. If I use a minifier, can it rid of it?
thanks.