There is a good tutorial here.
An important point to note is that while TypeScript adds static typing to JavaScript, the underlying runtime is the same as JavaScript.
Recall that with static typing, the type of every variable and expression is checked before the program runs. This enables errors to be caught at compile-time rather than run-time (in dynamic typing, by contrast, types are enforced only when code executes).
TypeScript is not a "mandatory" OOP language, in the same way as Java or C# (wherein the class is the basic unit of code organization - all data and behaviour is contained in a class). In JavaScript, and by extension TypeScript, this constraint is not present. Functions can live anywhere. Avoiding OOP hierarchies where possible tends to be the preferred programming model.
In the spirit of not mandating classes for general programming, static classes are unnecessary in JavaScript. Singletons are also generally not used.
No comments:
Post a Comment