import { SetFunction, GetFunction } from '../createStore.mjs'; import 'vue'; type PersistOptions = { /** * Storage to use for persistence (default: localStorage) */ storage?: Storage; /** * Custom serializer (default: JSON.stringify) */ serialize?: (state: T) => string; /** * Custom deserializer (default: JSON.parse) */ deserialize?: (str: string) => T; /** * Keys to persist (if not specified, all state will be persisted) */ partialKeys?: (keyof T)[]; /** * Version for migration support (default: 1) */ version?: number; /** * Error handler callback */ onError?: (error: Error, context: string) => void; /** * Merge strategy for rehydration (default: 'replace') * - 'replace': Replace the entire state * - 'merge': Deep merge with initial state */ merge?: "replace" | "merge"; }; /** * Middleware that persists store state to storage * @param key - Storage key * @param options - Persistence options */ declare function withPersist>(key: string, options?: PersistOptions): (initializer: (set: SetFunction, get: GetFunction) => T) => (set: SetFunction, get: GetFunction) => T; export { type PersistOptions, withPersist };