Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why use babel with typescript? #1

Closed
pkieltyka opened this issue Dec 21, 2017 · 3 comments
Closed

Why use babel with typescript? #1

pkieltyka opened this issue Dec 21, 2017 · 3 comments

Comments

@pkieltyka
Copy link

Hey guys,

Thanks for the thorough blog post. What I'm trying to understand is: why use babel at all with typescript? the tsc is quite good and will only get better, and Babel 6/7 do not support the full TS language.

@damassi
Copy link
Owner

damassi commented Dec 21, 2017

Hi @pkieltyka - This is a good question!

The reason is due to existing project infrastructure. If starting a project from scratch we would most certainly stick with tsc and go from there, but a lot of our codebases are somewhat old and have complex build pipelines. What Babel 7 + TypeScript support brings to the table is the ability to seamlessly merge old and new tech with very little fuss. For example soon, once Babel 7 stabalizes a bit, we'll be able to set it up in Positron and then import in components from our shared web repo Reaction directly, rather than having to pre-compile into dist and then pull from there. Another side plus is that with noEmit set to false we can lean on some of the advanced caching options available inside of Babel and Webpack leading to really fast recompiles since all that's happening on the tsc side is typechecking.

@alloy
Copy link

alloy commented Dec 21, 2017

We use some babel plugins that are quite essential to our code-bases, such as the Relay and styled-components ones. This means that we needed to have a pipeline like tsc -> babel -> js. Especially during development this can be quite costly (parse & generate code twice) and can be tedious to setup and maintain.

Even if we’d really wanted to (but I don’t think we’d want to), tsc has no plugin support at the moment, so being able to build TS code all within Babel is a win in that regard.

Babel indeed doesn’t support namespaces and const enums, but haven’t really had a need for that.

@pkieltyka
Copy link
Author

pkieltyka commented Dec 22, 2017 via email

@damassi damassi closed this as completed Jan 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants