UNPKG

kosha

Version:

⚡A modern, lightweight, fast, and powerful global state management library for modern React.js projects.

23 lines (22 loc) 851 B
import { BaseType, Middleware } from ".."; export interface PersistOptions<S> { /** Storage Key (must be unique) */ key: string; /** * Filter the persisted value. * * @params state The state's value */ partialize?: (state: S) => Partial<S>; /** * If the stored state's version mismatch the one specified here, the storage will not be used. * This is useful when adding a breaking change to your store. */ version?: number; /** * A function to perform persisted state migration. * This function will be called when persisted state versions mismatch with the one specified here. */ migrate?: (persistedState: unknown, version: number) => Partial<S> | Promise<Partial<S>>; } export declare const persist: <T extends BaseType>(options: PersistOptions<T>) => Middleware<T>;