redux-persist icon indicating copy to clipboard operation
redux-persist copied to clipboard

type safe persistStore

Open zi-gae opened this issue 4 years ago • 1 comments

https://github.com/rt2zz/redux-persist/issues/1140

redux compatible with persistStore.

// persistStore.d.ts

declare module 'redux-persist/es/persistStore' {
  import { Store, Action, AnyAction } from 'redux';
  import { PersistorOptions, Persistor } from 'redux-persist/es/types';

  /**
   * @desc Creates a persistor for a given store.
   * @param store store to be persisted (or match an existent storage)
   * @param persistorOptions enhancers of the persistor
   * @param callback bootstrap callback of sort.
   */
  // tslint:disable-next-line: strict-export-declare-modifiers
  export default function persistStore<S = any, A extends Action<any> = AnyAction>(
    store: Store<S, A>,
    persistorOptions?: PersistorOptions | null,
    callback?: () => any,
  ): Persistor;
}

declare module 'redux-persist/lib/persistStore' {
  export * from 'redux-persist/es/persistStore';
  export { default } from 'redux-persist/es/persistStore';
}

zi-gae avatar Feb 18 '21 06:02 zi-gae

This PR saved my life. Thanks a lot!

CXZ7720 avatar Jun 01 '21 17:06 CXZ7720