Typescript does not currently provide a syntax for C# style static constructors. However you can get the same effect with the pair:
- A non void static function
- A static variable assignment used to call that function:
Foot note: There is a request for a dedicated syntax to be added to typescript here : https://typescript.codeplex.com/workitem/862
e.g. (Non working / Proposed syntax) :
You can shorten that code by using an immediately executed function literal instead:
ReplyDeletestatic Ctor = (() => do stuff)();