-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typings for dispatch props #51
Comments
What exact error do you get? It's currently not possible to get the type of action from action creator but I think it's possible to add such feature. |
I also ran into this problem of wanting to use the type of the action from the action creator. I came up with a solution that "wraps" the action creator factory with another interface that exposes the actions as properties alongside the action creators. This allows for code that looks like:
Similarly, it exposes the types of each of the three async actions from an async action creator as separate properties ( |
See microsoft/TypeScript#21847, very soon we'll have a built-in ability to extract a return type of a function. |
So since TypeScript 2.8 you can use the built-in Please feel free to reopen if that doesn't solve your problem. |
Hi,
I'm trying to provide typings for my actions inside a connected component.
Given that the action is defined as:
The idea is to use those typings when defining
mapDispatchToProps
:However I get an error about the typings being incompatible. Is there a way to get the type of that action?
The text was updated successfully, but these errors were encountered: