Reputation: 1059
In javascript, when I define an AMD module I create and return a reference to the exposed portions of the module. When I use Typescript, I 'export' items, which causes them to be added to the 'exports' variable.
//javascript module
define(["require", "exports"], function(require, exports) {
exports.message = function(s) {
console.log(s);
}
}
In Typescript, I would like to get a reference to the external module from within the module, while it's being defined. Basically, I'd like access to the generated 'exports' variable, but can't find a way. Among other reasons, I'd like to be able to call Duradal's system.getModuleId and pass the current module.
Thanks
Upvotes: 0
Views: 63
Reputation: 220954
declare var exports;
export var n = 4;
console.log(exports);
Produces:
define(["require", "exports"], function(require, exports) {
exports.n = 4;
console.log(exports);
});
Upvotes: 1