3 ms·
Wouldn't the simpler build setup be to use TypeScript only for compilation? Why would you want to use Babel as well?
by stupidcar 9y ago
Wouldn't the simpler build setup be to use TypeScript only for compilation? Why would you want to use Babel as well?
- mariusmg 9y ago>Why would you want to use Babel as well? Because he thinks you can't do JS development without Babel.
- 1_player 9y agoFrom what I understand, TypeScript doesn't do any transpiling, so if you want to use ES6/2017 features, you're going to need Babel. (I haven't used TypeScript yet, so I might be wrong)
- gangstead 9y agoIt does transpiling. You can set the compiler target to es3/es5/es6 in your tsconfig.json and then you don't need Babel.
- pafje 9y agoTypescript has always transpiled to ES5 (by default it transpiles to ES3 actually). See: https://stackoverflow.com/questions/41173215/does-typescript-transpilation-handle-transpiling-es6-to-es5 https://stackoverflow.com/questions/41173215/does-typescript... The only counter-example that I know of is that async/await were initially only supported when transpiling to ES6, but this is not true since at least 2.2 (https://github.com/Microsoft/TypeScript/issues/5210 https://github.com/Microsoft/TypeScript/issues/5210).
- bastawhiz 9y agoBabel makes it possible to do compilation that TS doesn't do. E.g., you can use esnext language features that TS doesn't support, like do expressions. You can also use babel plugins that add utility, like the Babel power-assert plugin.