class keyword for defining classes:
The TypeScript compiler outputs a standardized class that enables simple and effective inheritance:
The best part of features like
class in TypeScript is that you can target different EcmaScript versions - if all of your target browsers supports ES6 natively, you can compile for that and use the native features. Which brings me to the next bit of awesomeness.
ES6+ features on every browser
Lest you think that TypeScript is a Microsoft-only show, Angular 2 is actually written in TypeScript, and is 100% supported in the framework. Other frameworks like ReactJS and Marionette can be used alongside TypeScript.
Obviously, this is the first conceptual hurdle one must clear when contemplating TypeScript. However, these days, a lot of web development has a compilation, minification, or packaging step. TypeScript’s compilation just adds a little more time to that step.
TypeScript is still very much under rapid development, and tools tend to lag behind the official releases. Like any evolving standard, keeping up to date can be challenging.
EcmaScript5 and EcmaScript6 are now realities, and their features are incorporated into the most recent releases of modern browsers. If you are like me and still need to support legacy browsers, don’t let that keep you from learning the new standards. TypeScript is a great way to start utilizing them even now. In addition, you can begin to utilize static typing to help make your code more reliable. Happy scripting!