5 ms·
I guess I failed to make this point properly, but Babel already supports static typing - you can use a plugin[0] and/or you can use it with Flow[1]. [0] https:
by phpnode 11y ago
I guess I failed to make this point properly, but Babel already supports static typing - you can use a plugin[0] and/or you can use it with Flow[1].
[0] https://github.com/codemix/babel-plugin-typecheck https://github.com/codemix/babel-plugin-typecheck
[1] http://flowtype.org/ http://flowtype.org/
- spion 11y agoUnfortunately, both of those are still very much inferior to TypeScript. I'm waiting for flow to improve enough to actually become usable (still missing basic things like ES6 or really any kind of modules support for type exports, afaik?). In the meantime, TypeScript works rather well and is looking to add JSX support.
- phpnode 11y agoI'm also keen for Flow to improve, but for now it's possible to turn off the `flow` transformer in Babel and pass the compiled output to flow - this preserves type annotations in the output
- samwgoldman 11y agoTypeScript is great, but you might look again at flow. ES6 features are being added (I'm adding let/const support) and many already exist. Import/export (incl. types) are in, fat arrow syntax, destructuring, shorthand syntax for objects. I get the most value of Flow through statically typed React component props, which is usable today with both `React.createClass`-style and `React.Component`-style components. In my experience, Flow will infer much more about "plainly" written JavaScript than TypeScript, which will fall back to `any` unless code is annotated. A small example, function types are contravariant in the negative position in Flow, but bivariant in TS—much weaker! TLDR, if you haven't looked at Flow recently, look again!
- spicyj 11y agoThanks for contributing to Flow!
- hazza1 11y agoReally like the idea of Flow but doesn't look like IDE support is there yet? This is the killer feature of types in Javascript for me - not sure I'd adopt it until then.
- samwgoldman 11y agoFor sure, tooling is an area that will get better over time. I am quite happy with the very simple vim-flow, but TypeScript's tooling and overall ecosystem (tsd/definitelytyped) is a lot more mature.
- iyn 11y agoThere are some packages that provide support for flow in atom editor, like: https://atom.io/packages/ide-flow https://atom.io/packages/ide-flow I've been testing atom for front-end development in the last few days and it's pretty good, definitely worth checking out (I'm saying this as a vim-lover)
- girvo 11y agoAtom with eslint, the react plugin and eslint-babel is just amazing for ES6/7 and React development. It's so much faster than it used to be, it's actually amazing.
- spion 11y agoI will. By the way, I always use TS with --noImplicitAny, and the number of type annotations I've had to add is rather small and very reasonable (mostly just on function arguments of methods and non-lambda functions). Seems like the flow docs may need an update to reflect the newest additions.