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

Mark StoreCreator's preloadedState argument as optional #3080

Merged
merged 1 commit into from
Jul 31, 2018

Conversation

srittau
Copy link
Contributor

@srittau srittau commented Jul 31, 2018

When wrapping createStore() using typescript, the typescript definition prevents an optional preloadedState argument:

function myCreateStore<S>(reducer: Reducer<S>, preloadedState?: Redux.DeepPartial<S>) {
    return createStore(reducer, preloadedState);
}

This will complain that type undefined is not assignable to DeepPartial<S>. Marking the preloadedState argument as optional fixes this problem.

@timdorr
Copy link
Member

timdorr commented Jul 31, 2018

Interesting that was overlooked, since StoreEnhancerStoreCreator already has an optional preloadedState. Funky.

Thanks for the one-character fix!

@timdorr timdorr merged commit 3cb7b8d into reduxjs:master Jul 31, 2018
@srittau srittau deleted the ts-store-creator branch July 31, 2018 17:46
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.

2 participants