UNPKG

zustand-persist

Version:
15 lines (14 loc) 737 B
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 {};