Skip to content
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

Improve typing of StoreEnhancer #1578

Merged
merged 2 commits into from
Apr 5, 2016
Merged

Conversation

Igorbek
Copy link
Contributor

@Igorbek Igorbek commented Apr 5, 2016

Following up #1526 (comment) here is a PR that enhance typyings for StoreEnhancer.

  • make StoreEnhancer to be parameterized by state type, because it's always being called with known type of the state, so that it opens a way to create state-specific enhancers
  • when a generic version of StoreEnhancer is needed, newly introduced GenericStoreEnhancer can be used, which a function with same signature but has a state type parameter; obviously it's assignable to any typed store enhancer
  • StoreEnhancer exposes a StoreEnhancerStoreCreator<S> as a result, that is a stricter version of StoreCreator which strictly expects to get a reducer and initial state (not optionals)
  • applyMiddlewares now returns GenericStoreEnhancer as the middlewares are generic
  • tests that show/prove usage of the new signature have also been added

/cc @aikoven

@aikoven
Copy link
Collaborator

aikoven commented Apr 5, 2016

Looks great to me.
Cc @ulfryk @Pajn

@ulfryk
Copy link

ulfryk commented Apr 5, 2016

Absolutely 👍

@aikoven aikoven merged commit f8439c6 into reduxjs:master Apr 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants