Skip to content

TypeScript Types

Redux Remember exports the following TypeScript types for better type safety in your application.

Storage driver interface for implementing custom storage solutions.

interface Driver {
setItem(key: string, value: any): void | Promise<void>;
getItem(key: string): any | Promise<any>;
}

See: Custom Storage Driver for complete implementation examples.

Configuration options for rememberEnhancer.

interface Options {
prefix?: string;
serialize?: (state: any, key: string) => string;
unserialize?: (state: string, key: string) => any;
persistThrottle?: number;
persistDebounce?: number;
persistWholeStore?: boolean;
errorHandler?: (error: PersistError | RehydrateError) => void;
initActionType?: string;
}

The errorHandler receives PersistError or RehydrateError instances.

See: rememberEnhancer for detailed descriptions of each option.

class PersistError extends Error {
// Thrown when persistence fails
}

Thrown when: State cannot be saved to storage (e.g., quota exceeded, storage unavailable).

class RehydrateError extends Error {
// Thrown when rehydration fails
}

Thrown when: State cannot be loaded from storage (e.g., corrupted data, parsing errors).

See: Error Handling Guide for complete examples of handling these errors.