-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
Typescript definition does not allow for enhancer composition #2130
Comments
I guess you're right, however as you can see in function createStore(reducer, preloadedState, enhancer) {
// ...
return enhancer(createStore)(reducer, preloadedState)
// ...
} Thus, in |
@santiagoaguiar I'm not sure this issue is dependent on #1648, because as Dan has labelled it, that issue just appears to be an enhancement, not a bug (like this issue). Having said that, I'm confused by this... To me it appears the TypeScript definition for Yet that doesn't seem right, because I have seen no other mention of this train of thought. This is my train of thought: If we mentally alias
So assuming
...(which is what |
You would have:
so to create a composed enhancer you would do:
Or:
And the implementation of a store enhancer would basically do:
I understand that given the current implementation of create store, enhancer would be undefined, but the typings are a bit confusing, and the implementation of Maybe I wouldn't have opened this bug if I'm OK with closing the bug if typings are OK and |
@santiagoaguiar You may want to check out #2201 |
Thanks, seems this is a tiresome issue :), but these are my takeaways:
|
Are we good with #2563 in place? (on the |
What is the current behavior?
Does not allow an enhancer argument, therefore the
This doesn't let you create a enhancer like
https://github.com/reactjs/redux/blob/master/src/applyMiddleware.js
with typescript, since you can't chain the enhancers.If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar.
Does not compile.
What is the expected behavior?
Should compile.
Which versions of Redux, and which browser and OS are affected by this issue? Did this work in previous versions of Redux?
3.6.0
Given #1648 I may be missing something, but I think changing it to
would be enough until that issue is resolved.
The text was updated successfully, but these errors were encountered: