Thursday, November 7, 2013

TypeScript: How to create a static class

One thing that took me some time to figure out is how to create a construct like static classes in TypeScript. I wanted to directly expose some functions without instantiating a class.

Here is how I did it:

It’s not completely the same as a static class in C# but it provides a similar experience.

2 comments:

Shruti Ramalingam said...
This comment has been removed by a blog administrator.
Tony said...

What are the advantages of using a module to achieve this versus creating an abstract class with static members / methods?