I've been using React + Redux + Typescript stack and I've been quite happy with it (It's hard for me to image how you could do big refactoring without TS). The fact that components props are verified by compiler instantly when I type is a big win. I believe with PropTypes you can't specifically describe what is the shape of your data, for example object with property of such name and the value of this property is obj…
> I use Typescript 2.0 RC No need to use the RC any more. 2.0 is out! https://github.com/Microsoft/TypeScript/wiki/What's-new-in-T...
If TypeScript is so great, how come all notable ReactJS projects use Babel?
221–230 of 247 posts
Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?
#222Earlier quoted context omitted.
This is basically my frustration with the whole trend toward smaller pieces over big monoliths. I don't need a best-in-class every tiny little thing; I just want reasonable tools I can expect to work together well.
Indeed. This is actually the point of DHH's much maligned "Rails is Omakase" article.
Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?
#223Why not both? I just installed flow and checked the JavaScript output of my TypeScript project (~2000 lines) and was a little disappointed it didn't turn up any errors.
Flow only type-checks files that have opted into it with the //@flow comment. It will have some trouble dealing with the compiled output of another tool like Typescript. For example, it probably wouldn't understand that output of how Typescript compiles classes into ES5 represents a class. Even if using both of them on the same code worked, Flow and Typescript are both a bit anal about certain dynamic javascript patt…
var live_items = new Array(); ^^^^^^^^^^^ Use array literal instead of new Array(..)
Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?
#224Earlier quoted context omitted.
Things like babel-core are still a must though.
They are? I haven't run into any problems with the latest typescript@next.
Even the ECMAScript feature table (https://kangax.github.io/compat-table/es6/) uses Babel and TS with core-js when comparing features, otherwise it'd be heavily browser dependent.
Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?
#225Earlier quoted context omitted.
The JS build system ecosystem could definitely use some help along the whole "reasonable tools I can expect to work together well" front. I swear, 30% of my time is spent fighting the build systems and their plugins that hate each other. EDIT: to add, I think the TS team has done such a bangup job on Typescript that I would love it if they could create a build system as well. Some things that would be nice to have: *…
I find webpack to be quite a 'holistic' solution I got pretty much everything out of the box or with minimal googling. I agree though over-fragmentation is a huge problem for JS, we need the big players (either foundations or companies) to put their weight behind one or two solutions and just get on with it :-)
Now that their Closure Compiler supports ES6 quite well, I've had a decent amount of success writing my app using straightforward ES6 and referencing the extensive Closure Library for functionality I would've previously pulled in npm packages for.
And the nice thing is that the whole library is written in such a way that all of the compiler's advanced optimizations and branch pruning, and dead code elimination work nicely on it so your compiled JS ends up containing only the code you need, and none of the code your don't need. If you want to use JSX in React projects, you can still zip the code through Babel or Typescript before feeding it to Closure.
It certainly won't work for every project, but it's one way to write modern JS without having to deal with the node/npm ecosystem too much...at least until things settle down a bit.
Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?
#226Earlier quoted context omitted.
We finally have tolerable garbage collectors.
And languages like Rust, which are working toward eliminating the need for a garbage collector.
Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?
#227Earlier quoted context omitted.
When using TypeScript subtly forces you into a MS toolchain. Then when everyone's hooked on VS Code BAM VS Code Pro Extreme Edition!
Strangely enough, I'd feel this would be fine. I would pay for a non-free upgrade of VSCode if it really brings in enough value. Its already on par with Sublime, and I paid for that... edit: Though if you mean TypeScript depending on VSCode to build, I doubt thats even possible at this point. Everything is available via the command line. Heck, there are even tools that build on top of the compiler API. (dts-generator…
Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?
#228Earlier quoted context omitted.
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.
To properly type Ramda, you need higher kinded types, which are not yet a feature of TypeScript. Though I find that Ramda's curried style isn't that useful now that we have arrow functions...
(I still use classes/objects for services with multiple related operations or polymorphism, but not for one trick pony "Executioners" for which Java would use a lambda -- which is what ES6 arrow funcs look like)
I wish I could vote the grandparent post up more.
Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?
#229I 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.
[1] https://flutter.io/faq/ [2] https://github.com/dart-lang/dev_compiler
Re: If TypeScript is so great, how come all notable ReactJS projects use Babel?
#230Because the masses will always gravitate towards inferior options.