Marketing Content Creator - you name it, she'll write it!
Posted on Apr 20th 2017
TypeScript allows developers to “take Arms against a Sea of Troubles” under many circumstances. For instance, if the code base is of significant size or if a project calls for multiple developers, many typical errors can be avoided, including situations when breaking changes are introduced (TS serves a kind of safety net). Also, if the development team is already comfortable with a statically-typed language, if a framework or library recommends the use of TS, or when there is no desire to handle a string of type checks). Besides, if you are looking to replace the use of Babel, TS is the perfect choice: it makes it possible to transpile ES6 code into ES5 because the former is essentially a subset of TypeScript. At the same time, it includes features like enums and allows you to initialize member variables in a constructor.
With TypeScript, developers can give a hand to the user too: by transpiling just once, they avoid the trouble of having to go through that every time a page is loaded. Even though it is possible to transpile in browsers now, it’s not a way to go — application/webpage performance is affected by this extra step.
The only downside of TS is that its use requires some extra work related with type definitions for JS libraries and frameworks, as well as having to deal with some strange debugging cases caused by inefficient support for variables in Sourcemaps. Besides, sometimes there simply isn’t enough time to generate the extra code that will be required when transpiling — certain features like inheritance, enum, generics, and async/await require that. And yet, TypeScript is here to help us solve the great dilemma in web development. The answer is, “TO BE”!
In the end, “Whether ’tis nobler in the mind to suffer the slings and arrows of” learning TS, each and every developer and team should decide for themselves. Nevertheless, It’s worth the headache for those working professionally (even learning as little as 5% of it is considered very positive) and, in reality, it’s not such a hard thing to do for those who already know JS. Besides, since TS is a language with a compiler, it goes beyond what Babel — which is only a compiler — can do. A developer using TypeScript benefits by the compiler/editor being able to point out many issues real-time; meanwhile, with JS you have to test your app in the browser and hopefully find the root issue. Thus, “bearing those ills” of learning TS is the way of the future.
TypeScript can be used with our Angular IDE, Webclipse plug-in and MyEclipse IDE.