Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the main differences between Babel and TypeScript

I know that TypeScript was used to write Angular2, which probably makes it a better choice for someone who wants to get into Angular2, but when I look at Babel it looks very much like TypeScript.

I noticed that many well known companies stick to Babel.

Some questions:

  1. What advantages do they have over each other?
  2. Which make them better or worse choice for the project/developer?
  3. What are the major differences between them and what make them unique?
like image 613
DevWL Avatar asked May 25 '16 07:05

DevWL


People also ask

Does TypeScript support Babel?

ts file generation. By using babel's support for TypeScript, you get the ability to work with existing build pipelines and are more likely to have a faster JS emit time because Babel does not type check your code.

What is the main difference between JavaScript and TypeScript?

TypeScript is an object-oriented programming language developed by Microsoft Corporation, whereas JavaScript is the programming language for the web. TypeScript is an open-source language to build large-scale web apps, whereas JavaScript is a server-side programming language that helps to develop interactive web pages.

What is the difference between Webpack and Babel?

Babel can be classified as a tool in the "JavaScript Compilers" category, while Webpack is grouped under "JS Build Tools / JS Task Runners".

Do you need Babel with angular?

You don't need to worry about babel in an angular 2+ application.


1 Answers

TypeScript is a superset of JavaScript that compiles down into plain JavaScript (ES3+). The main goal of TypeScript is to enable developers to leverage excellent static typing capabilities. It is suitable for large applications that would benefit from features like:

  • Type annotations & type inference.
  • Generics.
  • Interfaces, enums, namespaces, modules and classes (the latter two available in ES6).
  • Safe refactoring.

As far as I am aware, Babel simply "transpiles" newer ECMAScript features down into a format that is supported by older ECMAScript environments. It is suitable for developers who want to write plain JavaScript using newer language features.

like image 98
Marty Avatar answered Sep 23 '22 02:09

Marty