Is TypeScript not using revealing module pattern for classes?

typescript

Solution

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:

- Privates are captured with a closure

- Public members are visible as own properties of the object

- The object is created in an IIFE

Problem

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; }; })(); ```

Original source

Related problems