-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Conversation
👍 👍 awesome |
This is great! We want that in Redux, too. How does it work with NPM? Surely if you just compile to JS, the annotations are stripped. How do you intend to keep them in NPM for Flow consumers? Is there an established pattern for this? Thanks. |
@gaearon http://flowtype.org/blog/2015/02/20/Flow-Comments.html |
I haven't looked closely at how to make it work with NPM yet. It might be possible to just include a lib file with only the flow types of Dispatcher that can be included under the [libs] section of the .flowconfig. |
It looks like babel support emitting flow comments, babel/babel#1698 |
Yes, indeed! Thank you. |
neat! |
Does Flow actually handle those type errors? According to the docs in the Flow site it seems to not do that, and I'm testing a similar case with Redux and failing to make it type check. Here's the doc found in the Flow site: http://flowtype.org/docs/react-example.html#narrowing-union-types "Ideally, we would want to narrow down the type of action inside the individual cases. However, this is currently not possible with Flow. Not all hope is lost though. Flow supports any as type." |
Hmm, yeah I ran this exact code in my example and added the comments where there were actual errors. This is on flow v0.13.1 |
Yeah thanks @kyldvs, finally figured out how to do this. Seems like those docs are outdated then. |
Making dispatcher polymorphic allows strong type checking with flow