Live data from Hacker News

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

discuss.reactjs.org

151–160 of 247 posts

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

#151
post #20
post #16

Earlier quoted context omitted.

I recently started using TypeScript for my React projects and I am actually pretty happy. I am not actually sure what you mean by typed immutable records in this context, can you explain in more detail?

Immutable.js ( https://facebook.github.io/immutable-js/ ) doesn't have the greatest typescript type annotations. Due to limitations of TypeScript, there is no way to write types for immutable.js heterogenous maps (homogenous Maps and Vectors are fine though). Since immutable.js collections are recommended to be used with redux, and no one wants to bother using IMJS records instead of just maps, the types end up being…

Why use Immutable.js Record if you can make your own typescript immutable classes ?

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

#152
In my team we use both approaches depending on the size of the project, an inconvenience we ran into using typescript is the typings definitions, some are out of date or don't work at all, that and the fact that typing dependency management is not yet fully integrated means that you have to keep track of 2 set of dependencies.

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

#153
I am using TypeScript in a middle sized app (around 200 react components) and its help is invaluable for collaborating and sharing APIs.

Currently it is based on redux, but I have a feeling I have to write too much code, I am looking into MobX as an alternative.

I think TypeScript is the best thing that happened to the JS community in a long time.

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

#154

Isn't a large part of the win for typescript the tooling? Specifically the auto completion and documentation that pops up in various typescript enabled editors. Does such a thing exist for Flow? Could it? If it did that would go a lot further to push me to flow than that it just catches more errors. I get huge productivity gains from my editor helping me with API completions etc...

Our team is using Flow, and most devs use Nuclide[1] for the autocompletion and type hint popups. I can't compare it to any TS IDE, I'm afraid, but I can attest it's way more comfortable than doing without.

[1]: https://nuclide.io/docs/languages/flow/

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

#155
post #58

Earlier quoted context omitted.

It puzzles me also. Dart is solid language with great libraries, good tooling and still it is ignored by most developers. The truth is people from JS world seems to like 'cool' languages, but the one who want to be productive just uses boring Java/Dart etc.

Happy Dart programmer here. Great, easy to learn, productive language that runs on browser, server, mobile. I have no idea why Dart isn't used more.

Any tips on using Dart with mobile from Windows? I only need to target Android, not iOS.

I haven't touched Dart for over a year, but the Flutter page seems like it is on HTML, not native, and it only specifies Linux or OS X dev machine.

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

#156
I found the comment about soundness in the linked post to be kind of an odd remark.

It didn't take me long after reading that to come up with an invalid program that is accepted by Flow's type checker. (The typechecker normally rejects doing math against strings, but accepts this.)

    let array = [1,2];
    array.pop();
    array.push('hello');
    console.log(array[1] - 3);
To be clear, being completely sound is hard! There's a lot of space in type systems and Flow must make some hard decisions itself; whether it's "sound" or not is kinda orthogonal to whether it's useful or not. And I'm sure Flow is useful. So let's not talk about soundness.

(Disclaimer: I work with TypeScript and am pretty fond of it.)

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

#157

Earlier quoted context omitted.

It is. Try enabling the `compact` option or using something like Buble [1]. [1]: https://buble.surge.sh

I use buble. It transpiles ES6 to ES5 2.5 times faster than babel on average. But be aware that buble is still a work in progress and only supports a subset of ES6 features. A very usable subset, but a subset nonetheless.

And has it progress it will be slower to handle the most complex cases and follow the spec, than they will use a plugin architecture to let users develop their own language extension and modularize it, than they will only have to rename it to Babel because it won't be different.

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

#158
post #20
post #16

Earlier quoted context omitted.

I recently started using TypeScript for my React projects and I am actually pretty happy. I am not actually sure what you mean by typed immutable records in this context, can you explain in more detail?

Immutable.js ( https://facebook.github.io/immutable-js/ ) doesn't have the greatest typescript type annotations. Due to limitations of TypeScript, there is no way to write types for immutable.js heterogenous maps (homogenous Maps and Vectors are fine though). Since immutable.js collections are recommended to be used with redux, and no one wants to bother using IMJS records instead of just maps, the types end up being…

I feel like TypeScript needs some work in areas around typing methods - for example, I ran into type issues when trying to go more functional via ramda.js (http://ramdajs.com/) using stuff like compose, and ultimately it felt like a limitation of TypeScript.

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

#159
post #157

Earlier quoted context omitted.

I use buble. It transpiles ES6 to ES5 2.5 times faster than babel on average. But be aware that buble is still a work in progress and only supports a subset of ES6 features. A very usable subset, but a subset nonetheless.

And has it progress it will be slower to handle the most complex cases and follow the spec, than they will use a plugin architecture to let users develop their own language extension and modularize it, than they will only have to rename it to Babel because it won't be different.

The buble project wouldn't exist if babel ran faster and worked out of the box without setting up confusing config files. It fills a need.

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

#160
post #156

I found the comment about soundness in the linked post to be kind of an odd remark. It didn't take me long after reading that to come up with an invalid program that is accepted by Flow's type checker. (The typechecker normally rejects doing math against strings, but accepts this.) let array = [1,2]; array.pop(); array.push('hello'); console.log(array[1] - 3); To be clear, being completely sound is hard! There's a lo…

I guess they fixed it. Try it yourself. http://www.typescriptlang.org/play/

Argument of type 'string' is not assignable to parameter of type 'number' on line 3.

Post reply on HN