I wanted to move to TypeScript from traditional JS because I like the C#-like syntax.
My problem is that I can't find out how to declare static classes in TypeScript.
In C#, I often use static classes to organize variables and methods, putting them together in a named class, without needing to instatiate an object.
In vanilla JS, I used to do this with a simple JS object:
var myStaticClass = {
property: 10,
method: function(){}
}
In TypeScript, I would rather go for my C-sharpy approach, but it seems that static classes don't exist in TS.
What is the appropriate solution for this problem ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…