Hacker News new | ask | show | jobs
by 0x000000E2 1871 days ago
Eh, my take, Typescript won. Does the same thing as Babel but supports static types and inference in regular JS.
3 comments

The only thing Babel seems to have a moat around is being react's preferred jsx transpiler
on the contrary - tsc is so slow that most people use babel to strip out types in production.
What does "strip out types in production" means ? I've never heard of that.

For what I do, Babel is the slow part. switching babel to esbuild (still with tsc) divided my build times by 10.

The types aren't real anyway, what is there to strip out? Do you mean don't type check for production builds?
Everything is transpired to JS before it hits prod.

But yeah it's slow

bingo. tsc for dev. sucrase for prod.
Can it produce JavaScript runnable on Safari from iOS 9.3.6?

Those old iPads and iPhones just won't die... As well as a number of Macbooks that will never go past OS X 10.11.

Yes, it goes back to ES3.

Babel does have a neat automatic polyfill system typescript doesn't. But both can target real old JS versions. Most JS packages you'll find on NPM are still ES5.

Transpilers are quickly making JS a compiled language where the bytecode format is ES5 :)

tsc produces ES3, yes.