I need Babel with TypeScript

Should I use typescript? or can I only use ES6? [closed]


Closed . This question is based on opinions. No responses are currently accepted.

Would you like to improve this question? Update the question so it can be answered with facts and quotes by editing this post.

Closed 5 years ago.

My daily job is a client developer using AngularJS. We check whether we want to work with TypeScript. I've done some research on typescript and almost every JavaScript package I need needs to have definition type files. I didn't find this very practical, especially when I want to try something new and they don't have the definition for it. It's really frustrating. (Even the current jQuery definition gives me some problems when trying to use Typescript 1.5 Beta). I started looking at ES6 and it looks similar to TypeScript. Should I just use ES6 instead? I also heard that Angular 2 will fully support TypeScript. Is that a reason I should stick with it?





Reply:


I've been using Typescript for about a year and a half in my current angles project, and while there are some problems with definitions every now and then, the DefinitelyTyped project does an excellent job of keeping up with the latest versions of the most popular libraries.

However, there is a certain learning curve in transitioning from vanilla JavaScript to TS, and you should consider the ability of you and your team to make that transition. If you are using Angular 1.x, you will need to translate most of the examples you can find online from JS to TS. Overall, there aren't many resources currently available for using TS and Angular 1.x together. .

If you plan to use Angle 2 there are many examples of TS usage and I think the team will continue to provide most of the documentation in TS, but you certainly don't need to use TS to use Angle 2.

ES6 has some nice features and personally I plan to get used to them, but I wouldn't consider it production-ready language at this point. Mainly due to a lack of support from current browsers. Of course, you can write your code in ES6 and use a transpiler to bring it to ES5. This seems to be the most popular practice right now.

Overall, I think the answer comes down to what you and your team love to learn. Personally, I think that both TS and ES6 will have good support and a long future. I prefer TS though as you tend to get voice capabilities faster and for now the tool support is a bit better (in my opinion).







Decision tree between ES5, ES6 and TypeScript

Do you mind having a build step?

  • Yes - Use ES5
  • No - go ahead

Do you want to use types?

  • Yes - Use TypeScript
  • No - Use ES6

More details

ES5 is the JavaScript that you know and use in the browser today. It is what it is and doesn't require a build step to turn it into something that runs in today's browsers

ES6 (also called Called ES2015 ) is the next iteration of JavaScript, but it doesn't run in today's browsers. There are some transpilers that export ES5 to run in browsers. It is still a dynamic (read: untyped) language.

TypeScript provides an optional typing system while pulling functions from future versions of JavaScript (ES6 and ES7).

Note: Many transpilers (e.g., Babel, TypeScript) allow you to use functions from future versions of JavaScript today and export code that is still running in today's browsers.






We use cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By continuing, you consent to our use of cookies and other tracking technologies and affirm you're at least 16 years old or have consent from a parent or guardian.

You can read details in our Cookie policy and Privacy policy.