3 ms·
I completely agree with the sentiment that typed libraries are more stable and self-documenting. You can autogenerate documentation from typescript and it's gua
by STRML 11y ago
I completely agree with the sentiment that typed libraries are more stable and self-documenting. You can autogenerate documentation from typescript and it's guaranteed to be up to date, unlike JSDoc comments.
I personally have converted a few of my libraries [1] [2] over to Flow. It helps me personally, catches a lot of bugs, and does a great job of self-documenting while not getting in the way.
Flow has a lot of bugs and a lot of growth ahead of it, but it is far easier to get started with than TS. I highly recommend it.
1. https://github.com/STRML/react-grid-layout/blob/master/lib/utils.js https://github.com/STRML/react-grid-layout/blob/master/lib/u...
2. https://github.com/mzabriskie/react-draggable/blob/master/lib/utils/positionFns.es6 https://github.com/mzabriskie/react-draggable/blob/master/li...
- Eridrus 11y ago> Flow has a lot of bugs and a lot of growth ahead of it, but it is far easier to get started with than TS. I know this was definitely the case when I started using TS a few years ago, but they recently added support for compiling .js files in your typescript projects, so you only need to deal with the compiler one file at a time. Admittedly I haven't used it, but I think it should have made the migration easier. Probably still not as easy as Flow, but easier...
- STRML 11y agoThat does help a lot and was a long time coming. TS is a little harder to get started with for a few reasons. For one, it simply does more, with features like interfaces (which "sort of" exist in Flow), and public/private accessors. One distinct advantage of Flow is that it is not a build step, but is more like a linter. I like this - it doesn't re-invent the wheel, so you don't have to choose between having the latest features or being fully TS-compatible. On the other hand, Flow's typechecking is far less complete, and it still uses its own home-rolled parser which occasionally has issues parsing certain ES2016+ features, such as decorators. If I were starting a project from scratch, I would likely use TS as it's simply more complete. But if I were migrating an existing project, Flow starts paying off right away and is easy to integrate.
- Akkuma 11y agoAs you mentioned, Flow not being a build step seems to be a big win to me. A lot of different tools use or encourage you to use babel and babel is ahead of TypeScript in ES6/ES7, http://kangax.github.io/compat-table/es6/ http://kangax.github.io/compat-table/es6/. If you use TypeScript your chain suddenly becomes much slower/more complex.