Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
Nataliya Muriy
Marketing Content Creator - you name it, she'll write it!

TS or JSTypeScript or JavaScript?  Now, that is the question!  If TypeScript, a typed superset of JavaScript, compiles down to JavaScript, the obvious query is why have it in the first place.  Another logical inquiry is whether it’s ideal for everyone, how and where it can be used.

There are two good reasons why developers should bother learning TypeScript (TS): the added features it offers and the chance to innovate freely.  What does TS add to JavaScript (JS)?  Among the traits that stand out are interfaces, abstract classes, and algebraic data types.  Being a transpiled language, TS implements a feature in question in raw JS; meanwhile, the developer can work with the interfaces without worrying about the details.  Besides, since it starts off based on JS, TypeScript helps you avoid the hassle of making experiments with new syntax — instead, it allows you to build on it while not deviating from the standard too much.  The result?  There is more room for innovation in such a user-friendly environment which makes your life so much easier (source).

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 TypeScriptdevelopers, 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 (source). 

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”!

bob loves TS

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 (source).

TypeScript can be used with our Angular IDE, Webclipse plug-in and MyEclipse IDE.


Related Posts

Angular 4, TypeScript 2.2 & More, now in Webcl... The day is finally here, and we are not just talking about our release -- Angular 4 is out! Earlier this year we were discussing some of the advantages of Angular 4 like the fact that it comes with better tools, requires 25% less code due to a better compilation, will get updates every 6 months and many others benefits.  The long wait is over -- it...
MyEclipse 2017 Stable 1.0 is out! Earlier this year we were really excited about being able to provide you with initial support for Angular 2. Well, now with this release you also get tooling support for Angular 4. Not only that, but we wanted to make sure you were able to update simply to Angular 4 -- with a one-click flow that does most of the steps for you. Once you are all set,...
MyEclipse 2017 – Welcome to the Next Generat... Today is a very exciting day at Genuitec! As we speak, we are just unveiling MyEclipse 2017! This is the first release of what’s going to be an amazing year of new functionality for the MyEclipse (and Webclipse) customer base. This release represents our best way to start off the year right. Yes, we are based on Neon. Yes, MyEclipse 2017 also comes...
Webclipse CI 9 is out, and with it TSLint! While our previous release included TypeScript, which provides you with incredible validation of syntax errors in your code, this release took code checking to a whole other level by adding TSLint. TSLint is an extensible linter for TypeScript and complements TypeScript by checking your code’s readability, maintainability, and functionality errors....

Posted on Apr 20th 2017