UNPKG

@daysnap/utils

Version:
22 lines (20 loc) 769 B
interface StorageManager<T = any> { setItem(val: T): T; getItem(defaultVal?: Partial<T>): T; removeItem(): void; updateItem(val: Partial<T>): T; } declare function factory(type: 'sessionStorage' | 'localStorage'): { setItem: <T = any>(key: string, val: T) => T; getItem: <T_1 = any>(key: string, defaultVal?: Partial<T_1> | null) => T_1; removeItem: (key: string) => void; updateItem: <T_2 = any>(key: string, val: Partial<T_2>) => T_2; clear: () => void; generate: <T_3 = any>(key: string) => { setItem: (val: T_3) => T_3; getItem: (defaultVal?: Partial<T_3> | undefined) => T_3; removeItem: () => void; updateItem: (val: Partial<T_3>) => T_3; }; }; export { type StorageManager, factory };