Is TypeScript not using revealing module pattern for classes? I expected different result from this code.
class Test {
private privateProperty: any;
public publicProperty: any;
}
generates this:
var Test = (function () {
function Test() { }
return Test;
})();
I expected something like this:
var test = (function(){
var privateProperty;
var publicProperty;
return {
publicProperty: publicProperty;
};
})();
RMP is not appropriate for class-based design. module
does what you want:
module myMod {
var x = 31;
export var y = x + 15;
}
Generates:
var myMod;
(function (myMod) {
var x = 31;
myMod.y = x + 15;
})(myMod || (myMod = {}));
Salient features here:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With