@codelet/core
Version:
mini core
11 lines (10 loc) • 367 B
TypeScript
type DefaultVal<T> = T extends Record<string, any> ? Partial<T> : T;
export declare function createStorage<T = any>(key: string): StorageInstance<T>;
export interface StorageInstance<T = any> {
setItem(val: T): T;
getItem(): T | undefined;
getItem(defaultVal: DefaultVal<T>): T;
removeItem(): void;
updateItem(val: DefaultVal<T>): T;
}
export {};