redux-state-sync icon indicating copy to clipboard operation
redux-state-sync copied to clipboard

TypeScript typing wrong in returned store after wrapping reducers with withReduxStateSync()

Open karlshea opened this issue 4 years ago • 1 comments

const store = createStore(reducers, defaultState, enhancers);

store is Store<CombinedState<ApplicationState>, AnyAction> & {dispatch: unknown}

Once I wrap reducers in withReduxStateSync(), store is Store<Reducer<any, AnyAction>, AnyAction> & {dispatch: unknown}.

If I totally erase the typings it works:

const store = (createStore(
  reducers,
  defaultState,
  enhancers
) as unknown) as Store<CombinedState<ApplicationState>, AnyAction> & {
  dispatch: unknown;
};

karlshea avatar Dec 26 '20 21:12 karlshea

Thanks for pointing this out. Currently, the type is a bit wrong, need to support generic types. let me add it in.

aohua avatar Dec 28 '20 02:12 aohua