top | item 13708154

(no title)

davesnothere | 9 years ago

One reason flow might be considered "better" (context is key) is that it plays well with the babel ecosystem, letting one pick and choose their language features.

discuss

order

Touche|9 years ago

Picking and choosing language features via babel plugins (many of which will never become part of JavaScript) is an anti-feature. You essentially are creating your own language that only you understand.

shados|9 years ago

The parser features are fixed. The plugins enable/disable them, but they're already "there", just toggled. As far as I know at this point the parser is not pluggable. Babel is a playground for the official TC39 proposals so it might get stuff a little early, but that's about it.

Where the plugins shine is when compiling those (part of the standard) features to something interesting for production. Better inlining, adding debugging and instrumentation, compiling away certain things, optimizing your views for performance, etc.

All things that don't change the language whatsoever, but can improve your debugging or production experience.

That can be done in TS world (and is quite common) by targeting ES6 and piping the result in Babel though. It's just annoying.

You do have things like Prettier not being compatible with TS because different parsers, though.

hzoo|9 years ago

We don't support custom syntax that isn't already a proposal (meaning it has potential to be in JS), and we also encourage using presets like https://github.com/babel/babel-preset-env instead of providing your own configuration of plugins unless you are more of a power user.

It's our intention as a tool to align with TC39 and transition users to using native JS when it's supported

WorldMaker|9 years ago

Typescript and Babel play well together, too.

Rapzid|9 years ago

Yeah, I personally don't mess around with Babel but I imagine you could just take TypeScript's ES6 output and feed it through babel in your gulp/webpack pipeline.