javascript - How to force TypeScript exports to the end of the JS output? -
i use lot of export statements following, cumulate module's exports @ bottom of file:
export { foo1 bar1, foo2 bar2, ... }
lately have learned that...
let foo : number = 0; export { foo bar }
...is not @ same as...
let foo : number; foo = 0; export { foo bar }
...because latter delivers undefined in exports.bar. happens because compiled javascript has export statement of exports.bar = foo before assignment. find hardly intuitive. read on typescript module pages, seem miss description of behaviour. there?
is there way force output's export statements @ bottom rather right after declaration? thanks.
this sounds more bug in typescript. future reference, typescript 1.8 compiles following code:
let foo : number; foo = 0; export { foo bar }
into javascript:
"use strict"; var foo; exports.bar = foo; foo = 0;
i tried typescript 2.0 beta, , seems fixes it:
"use strict"; var foo; exports.bar = foo; exports.bar = foo = 0;
Comments
Post a Comment