Why Does Typescript Mix The Module And Prototype Pattern?
I was having a look at the JS code generated by TypeScript on this page: http://www.typescriptlang.org/Playground/ Basically, to create a Greeter class, it outputs this: var Greete
Solution 1:
The use of module pattern here is to create a closure, allowing for more control over any closed over variables (nothing leaking into global, no global pollution), and allowing for the creation of 'private' variables (variables that only exist via the module pattern's closure).
Post a Comment for "Why Does Typescript Mix The Module And Prototype Pattern?"