0

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.

1 Answer 1

1

This was a bug in the 1.0RC compiler. See this page where you can get a hotfix tsc.js file.

Sign up to request clarification or add additional context in comments.

1 Comment

it worked.. thanks. can u please answer the other qn 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.