zustand-persist
Version:
persist and rehydrate redux stores
15 lines (14 loc) • 737 B
TypeScript
import { SetState, GetState, StateCreator, State, StoreApi } from 'zustand';
import { KeeperOption } from './keeper';
import { NonFunctionPropertyNames } from './reconcile';
export interface PersistOption<S extends State> {
key: string;
denylist?: NonFunctionPropertyNames<S>[];
allowlist?: NonFunctionPropertyNames<S>[];
}
declare type ConfigurePersistOption = KeeperOption;
export declare function configurePersist(option: ConfigurePersistOption): {
persist: <TState extends object>(option: PersistOption<TState>, fn: StateCreator<TState, SetState<TState>, GetState<TState>, StoreApi<TState>>) => StateCreator<TState, SetState<TState>, GetState<TState>, StoreApi<TState>>;
purge: () => Promise<void>;
};
export {};