It would seem there are problems with static and runtime type checking and redux actions. I won't reiterate the problem but I have a ticket open on the Flow repo here (#4737).
Since the two of these don't seem to play well together in my use case I've decided to disable flow-runtime. Is there anything else I should do aside from removing the plugin from the .babelrc file?
You could try to do this
// Redux Emits a bunch of it's own stuff so I need to allow those
export type BaseReduxAction = { type: $Subtype<string> };
This matches any action that has the type field and uses a string and still allows you to typecheck your other actions based on the switches or ifs on the action.type
I agree it does seem to be a bit of a headache with not a lot of clear documentation. I'd love to find some more concrete examples of thunks, stores, createStore and dispatch/getState being used together in an app.
@csprance Thanks! That is a fantastic workaround. +1 to finding more concrete examples. Looking forward to seeing what people far smarter than myself do for this sort of thing.
You can check out my repo here to see a better example of how to use redux, redux-thunk action type and flow stuff. I'm still learning so let me know if you see anything dumb
https://github.com/csprance/MisRCON/blob/v2/app/constants/ActionTypes.js#L71
Most helpful comment
You could try to do this
This matches any action that has the type field and uses a string and still allows you to typecheck your other actions based on the switches or ifs on the action.type
I agree it does seem to be a bit of a headache with not a lot of clear documentation. I'd love to find some more concrete examples of thunks, stores, createStore and dispatch/getState being used together in an app.