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

StoreCreator does not accept Partial<S> as preloadedState #3670

Closed
nappy opened this issue Jan 6, 2020 · 3 comments
Closed

StoreCreator does not accept Partial<S> as preloadedState #3670

nappy opened this issue Jan 6, 2020 · 3 comments

Comments

@nappy
Copy link

nappy commented Jan 6, 2020

When passing an Partial<StoreState> to createStore<StoreState, AnyAction, {}, {}> as preloaded state, even when using the result of combineReducers, type checking fails as of redux 4.0.5

Steps to Reproduce

Find a minimal demo here:
https://codesandbox.io/s/blazing-rgb-o8f03

What is the expected behavior?

It should not throw type errors as in redux 4.0.4
Might be related with #3485

@nappy
Copy link
Author

nappy commented Jan 6, 2020

Nevermind I was using the following type arguments createStore<StoreState, AnyAction, {}, {}> and had to adjust to createStore<CombinedState<StoreState>, AnyAction, {}, {}> as of redux 4.0.5 and is probably the intended behavior.

@nappy nappy closed this as completed Jan 6, 2020
@nappy
Copy link
Author

nappy commented Jan 6, 2020

Although the resulting store is now Store<CombinedState<StoreState>, AnyAction>, which does not seem right. Maybe someone can clarify.

I do not know if such changes in type arguments are considered braking or not, but to me it still feels wrong.

@nappy nappy reopened this Jan 6, 2020
@timdorr
Copy link
Member

timdorr commented Jan 6, 2020

Yes, this is a know problem with the current types. This will be fixed in 5.0.

@timdorr timdorr closed this as completed Jan 6, 2020
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

No branches or pull requests

2 participants