Software Engineering :: Programming :: Languages :: JavaScript :: TypeScript :: Babel (@babel/preset-typescript)
⪼ Made with 💜 by Polyglot.
Babel is a popular tool that is mainly used to convert ECMAScript 2015+ code into a backward-compatible version of JavaScript in current and older browsers or environments. It can also convert TypeScript code into JavaScript. Why would you use Babel to transpile TypeScript when the TypeScript compiler already does this? Well, Babel is capable of converting JSX to JavaScript - the TypeScript compiler can't do this. So, if your project is built using React, you will need Babel. If a project already uses Babel, it is simpler for that to take full responsibility for all the transpilation. That leaves TypeScript to focus on what it is best at - type checking.
npm install --save-dev @babel/core @babel/preset-env @babel/preset-typescript @babel/cli
- TypeScript-Babel-Starter
- How to Integrate TypeScript with Babel
- Using Babel with TypeScript
- Babel for transpiling, tsc for types
- Using Babel with TypeScript
- @babel/preset-typescript
- @babel/plugin-transform-typescript