Live data from Hacker News

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

discuss.reactjs.org

81–90 of 247 posts

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

#81

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.

What do you mean "fait accompli"? Was the Dart team supposed to give the community a chance to abort the language from existing, and the community was upset that it was completed and published without the input of people who wanted it not to be?

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

#82
post #79

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.

I can't find in the documentation, does the `pub build` tool do code splitting? I can't use a language without this.

Sorry for my ignorance, but does that amount to loading a library on demand? If so, yes, Dart can do this:

  import 'package:deferred/hello.dart' deferred as hello;
  // When you need the library, invoke loadLibrary() using   the library’s identifier.

  greet() async {
    await hello.loadLibrary();
    hello.printGreeting();
  }

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

#83
post #17
post #10

Earlier quoted context omitted.

This. Many React projects use JSX, decorators and class properties to the max, so they needed babel in the first place. Now if you want to add types, Flow is easier to integrate than switching to another compiler.

My opinion is that all the extensions on JavaScript should be implemented as Babel plugins, including Typescript. That would solve all the compatibility problems. Well, when Babel first came out I also thought that it should have been a Sweet.js plugin so maybe I don't have the best understanding of this "transpiling" circus.

>My opinion is that all the extensions on JavaScript should be implemented as Babel plugins, including Typescript. That would solve all the compatibility problems.

Then we'll have the Babel problem. E.g. how they handled 2 to 3 transition doesn't inspire confidence.

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

#84
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.

Lol what part of Typescript do you have to pay for?

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

#85

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".

what? this makes no sense. Typescript is just a superset of javascript. you wouldnt have to rename anything..

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

#86
post #67
post #26

Earlier quoted context omitted.

it's like they don't even realize how ridiculous this shit sounds..

I don't think the point of WebAssembly is to target the DOM. I think it it's to provide a common low level API across browsers that many languages can target.

Sorry was referring to the infinite layers of transpiling and sub-languages that people talk about like it's normal, which I admittedly get why they exist, but it's still fucked. But that too. (though maybe wasm + canvas will let someone eventually implement a decent ui toolkit? Think I saw at least one attempt at this.)

Current project could maybe benefit from TypeScript, and certainly async/await, but still wonder if it's less of a hassle to just wait for wider support.

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

#87
post #81

Earlier quoted context omitted.

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.

What do you mean "fait accompli"? Was the Dart team supposed to give the community a chance to abort the language from existing, and the community was upset that it was completed and published without the input of people who wanted it not to be?

>Was the Dart team supposed to give the community a chance to abort the language from existing

No, he means that the Dart team was supposed to solicitate opinions on how to build Dart and what the best objectives for it would be, but instead they showcased it in "almost done" form, and only then tried to attract a community.

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

#88
post #81

Earlier quoted context omitted.

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.

What do you mean "fait accompli"? Was the Dart team supposed to give the community a chance to abort the language from existing, and the community was upset that it was completed and published without the input of people who wanted it not to be?

[deleted]

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

#89

Earlier quoted context omitted.

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.

> Dart doesn't introduce that many advantages over JS for all of its differences As someone with experience in both languages, I could not disagree more. > Dart was originally presented as a wholesale replacement of Dart I think you meant replacement of JS here. I guess it depends entirely on what you think of JS as a language. I, for one, would rather a language that fixes core issues with JS, instead of just being…

>As someone with experience in both languages, I could not disagree more.

Elaborate then. Because one's major advantages can be another's (and sometimes, objective) trivialities...

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

#90

Earlier quoted context omitted.

> Dart doesn't introduce that many advantages over JS for all of its differences As someone with experience in both languages, I could not disagree more. > Dart was originally presented as a wholesale replacement of Dart I think you meant replacement of JS here. I guess it depends entirely on what you think of JS as a language. I, for one, would rather a language that fixes core issues with JS, instead of just being…

> I think you meant replacement of JS here. I guess it depends entirely on what you think of JS as a language. I, for one, would rather a language that fixes core issues with JS, instead of just being a superset of JS. If I were aiming to replace JS, I'd fix what Dart does, but I wouldn't stop with merely fixing what Dart does. Dart, despite being an entirely new language, has a less expressive type system than TS. I…

> has a less expressive type system than TS

Care to elaborate on that?

As for the rest of your comment, I'm with ya. I guess they're reasoning behind that was they thought a lot of development would start out untyped with additional types added as development progressed. I think that assumption didn't pan out, at least that's not how I do it.

Official answer from https://www.dartlang.org/faq:

"Q. But don’t you need sound typing information to get high performance?

Sound types can help with performance but aren’t essential. What we need are uniform, simple semantics. Modern VMs can use actual runtime behavior as a valuable signal for optimizations."

Post reply on HN