Live data from Hacker News

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

discuss.reactjs.org

91–100 of 247 posts

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

#91
TypeScript works very well with React, less so with Redux/ImmutableJS.

We just moved our app from Redux and ImmutableJS to mobx and it's been a treat: we now get full typing and it's much less verbose. We don't need to repeat the payload definition at every point, we have a store where we call a method and that's it. Highly recommend checking out mobx if you use TS.

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

#93
post #79

Earlier quoted context omitted.

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(); }

That does indeed work. I just tried it, and it works beautifully.

The only problem is that the main output js file is still 107kb, quite large.

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

#95

Why waste your time with half-baked type systems that try to achieve some compromise over JS idiosyncrasies. Go all in with purescript[0] :D Simple, elegant, strong typed and compiles to JS. [0]: http://www.purescript.org/

Yeah, why waste your time learning a little bit of new syntax when you can learn a whole lot of new syntax /s

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

#96
post #63

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.

TS seemed more willing to interoperate with the rest of the JS ecosystem - gradual typing, external .d.ts files for popular libraries, working with existing build tools and module systems. Whereas Dart felt like more of a gated community where you were expected to do things the Dart way and there wasn't much support for traditional JS.

Dart has gradual typing

> working with existing build tools and module systems

I'd say they replaced it with a better tool, pub.

The one good argument you have there is .d.ts files. Dart lacks them, but there are tools to generate js bindings from those same .d.ts files. https://github.com/jirkadanek/definitely_typed

I haven't used it though, so I can't say if it works as advertised.

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

#97

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.

Dart is not structurally typed and so only provides help typing the parts of your program you have actually modified to use Dart. TS and Flow both provide structural typing that makes it far easier to convert existing code. Just annotate it (no need to even modify the existing code, just plop a `.d.ts` or `.flow` file in the right place) and immediately start to see benefits.

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

#98

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.

TS is more of an evolution of what exists. In that sense it's a possible "future" implementation of JavaScript -- still keeping the same semantics, but in a more structured way.

Dart is a different language so it's a different path. It's no different than, say, using C# or Java or C or whatever language that can be transpiled to JavaScript.

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

#99

The main reason for using Babel was async/await. However, the lastest TypeScript verion (typescript@next) can compile async/await for older browsers, so there is no reason for me to use Babel anymore.

Things like babel-core are still a must though.

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

#100

Why waste your time with half-baked type systems that try to achieve some compromise over JS idiosyncrasies. Go all in with purescript[0] :D Simple, elegant, strong typed and compiles to JS. [0]: http://www.purescript.org/

Yeah, why waste your time learning a little bit of new syntax when you can learn a whole lot of new syntax /s

And not just any syntax. Jump on the bandwagon and learn the gods[0] syntax. :D

[0] https://github.com/purescript/purescript/wiki/Differences-fr...

Post reply on HN