Live data from Hacker News

If TypeScript is so great, how come all notable ReactJS projects use Babel?

discuss.reactjs.org

41–50 of 247 posts

Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?

#41

I was always wondering why HN crowd is ok with TS and so prejudiced against Dart - Dart has NG2, await async in older browsers and good tooling (webstorm, vscode) and much saner package system. When doing lot of small web apps - it's easier to mantain.

At least in my view, there's a couple of big things: Dart doesn't introduce that many advantages over JS for all of its differences, and TS introduces many of them with a smaller diff; there's also the presentation of it—Dart was originally presented as a wholesale replacement of Dart, to ship in all browsers, the language more or less as a fait accompli, which rubs plenty of people the wrong way.

Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?

#42
I would have switched to typescript but I had to rename EVERYTHING from something to something else in order to use TypeScript. If that's how "compatible" starts, well, no thanks cause clearly that's just the start of the pain.

Compatible should be same files, new compiler = "just works".

Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?

#44
post #38

Earlier quoted context omitted.

It's tempting to think this way, but it's a performance/complexity nightmare. If everything is a plugin, then you need ways for different parsers to talk to each other to deal with nested syntax, plus ways for different syntactic transformers to correctly handle nesting of certain things. For example, if you desired to implement a plugin for "thin arrows", and a plugin for JSX, how would you parse this? const x = } /…

Aren't the Babel people trying to define a common standard format for the AST so different parsers and code generators can better work together? That said, if you look at TS as a superset of Babel plugins, there's actually not much to TS that is TS-specific. Adding that to Babel would be relatively simple. You seem to be arguing it's a slippery slope. We're not talking about arbitrary syntax. We're talking about a fa…

> Aren't the Babel people trying to define a common standard format for the AST so different parsers and code generators can better work together?

Actually kind of the opposite - babel used to use the common ESTree AST format, but they've moved away to something similar but incompatible.

Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?

#45

Speaking as the person who implemented JSX support for TypeScript, I question the premise! JSX support (and implementation of React semantics for typechecking that JSX) was a very popular feature request. I can tell you just from how quickly people notice when something JSX-related changes in the nightly build that there are a lot of people using TypeScript with React. Also, since this seem to be a popular misconcept…

i'm one of the people whose team has benefited greatly from your work on .tsx, thanks for the great tool!

i suspect a great many typescript users are not open source.

Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?

#46
post #30

I do not believe compilation nor a type system belong in JavaScript. It's better to have something like "Flow" that does static analysis of the code as you write. I might even go as far as putting on a "tin foil hat" and state that Typescript is a trick to lock you into their proprietary ecosystem of expensive tools that everyone have to buy into just to communicate with you once you are locked in.

Why not ?

I only see advantages for static typing for a small cost of time: you prevent most of Type Error from happening, you get automatic auto-completion, refactoring errors are easier to catch and feel safer. Either way, you need to specify the type of the arguments in the documentation of your function (I can sometimes even find the C# LINQ's function I'm looking for just by looking at the return type of the list of function).

You could even use Flow and Typescript to catch

Aside from the proprietary reasons (which I believe are unfounded since the whole Typescript ecosystem is opensource), why do you think static typing doesn't belong in Javascript ?

Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?

#47
post #30

I do not believe compilation nor a type system belong in JavaScript. It's better to have something like "Flow" that does static analysis of the code as you write. I might even go as far as putting on a "tin foil hat" and state that Typescript is a trick to lock you into their proprietary ecosystem of expensive tools that everyone have to buy into just to communicate with you once you are locked in.

True, VS Code is so damn expensive!

Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?

#49
post #37
post #7

Because a lot of notable ReactJS projects are irritatingly enamored with all the latest ES6/ES7/ESCloudCuckooLand features, not all of which are supported by TypeScript. I've noticed this a lot in the Redux realm. For every possible problem there seems to be a solution that harnesses one particular new/proposed bell & whistle.

This is another reason: > If you work outside the San Francisco bubble and are stuck on Windows, Flow isn't really an option at the moment.

It is not the case anymore. Flow now supports windows out of the box.

Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?

#50
post #30

I do not believe compilation nor a type system belong in JavaScript. It's better to have something like "Flow" that does static analysis of the code as you write. I might even go as far as putting on a "tin foil hat" and state that Typescript is a trick to lock you into their proprietary ecosystem of expensive tools that everyone have to buy into just to communicate with you once you are locked in.

My team is 'locked' into TS on a large project. We have yet to purchase any TS related tooling, and have no plans or need to do so. Given that TS transpiles to JS, I'm unsure as to how any project can be truly 'locked' into the ecosystem. I'm really unsure what you are basing your fears upon.
Post reply on HN