redux-persist
redux-persist copied to clipboard
type safe persistStore
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';
}
This PR saved my life. Thanks a lot!