-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
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
Fix MiddlewareAPI in .ts #2362
Comments
Should it? Dispatch is able to accept any action, not just a specific subtype of |
generic type of state vs generic type of action. it is differen things... |
click on links please... |
I did. State type is generic because it depends on your state shape. Actions are not restricted to any subtype of Also, there might be a misconception with the generic parameter of interface Dispatch<S> {
<A extends Action>(action: A): A;
} The reason for this is to allow middlewares to augment this interface with custom signatures, i.e. |
@aikoven is correct here. Because you can enhance the store with middleware to accept any type of input as an "action", it needs to be generic. |
OK. I understood. Yes it is logical. But it is not clear at first sight. Flow js - 2 type parameters. Ts - 1 type parameter. Think you need to leave a comment in code for the descendants |
MiddlewareAPI should have 2 params in type same as flow-typed/redux.js:
https://github.com/reactjs/redux/blob/master/index.d.ts#L256-L259
The text was updated successfully, but these errors were encountered: