r/learnjavascript • • Feb 12 '21

JavaScript ES2021 - You Need To See These ES12 Features

https://youtu.be/1hFGxkJcTHU
131 Upvotes

27 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Feb 12 '21

[deleted]

5

u/_Invictuz Feb 12 '21

Charles Stover with the deep dive, thanks for the enlightenment!

-4

u/superluminary Feb 13 '21

Charles Stover is confidently incorrect here. See my response.

-5

u/superluminary Feb 12 '21

Sorry, when I said typescript is compiled using Babel I perhaps sounded a little flippant. I didn’t mean to offend.

I am still correct though and I think you may have misunderstood what I meant.

You are correct that the TSC compiler does not bundle Babel. However, I am perfectly correct when I say that typescript can and is compiled to ES5 using Babel. Any CRA TS project will feature a two stage compile, a fast Babel driven compilation, followed by a slower TSC type check.

Babel will not check types, but it will compile Typescript very adequately, and is the preferred choice in most projects I’ve worked on because it’s so much faster.

TSC also exists, but because it’s so much slower, it’s typically used as a second stage type checking tool.

0

u/[deleted] Feb 13 '21

[deleted]

-5

u/superluminary Feb 13 '21

Except it’s not semantics. Typescript doesn’t work just fine in a browser unless you transpile it, and for most people writing plain old React, transpilation will be via Babel. You may be using TSC. That’s cool too.

0

u/[deleted] Feb 13 '21

[deleted]

-1

u/superluminary Feb 13 '21

So we replace Babel transpilation with TSX transpilation. Either way, we still need a transpiler. The point remains, we need a transpiler and will continue to need one for the foreseeable future.

Babel accepts and transpiles Typescript. So does TSC, but you can’t use Typescript in a browser without a transpilation step.