Sunday, April 7, 2013

Typescript static constructors for classes

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) :