import type { WritableAtom } from 'jotai'; import { RESET } from './constants'; export declare const NO_STORAGE_VALUE: unique symbol; declare type Unsubscribe = () => void; declare type SetStateActionWithReset = Value | typeof RESET | ((prev: Value) => Value | typeof RESET); export interface AsyncStorage { getItem: (key: string) => Promise; setItem: (key: string, newValue: Value) => Promise; removeItem: (key: string) => Promise; delayInit?: boolean; subscribe?: (key: string, callback: (value: Value) => void) => Unsubscribe; } export interface SyncStorage { getItem: (key: string) => Value | typeof NO_STORAGE_VALUE; setItem: (key: string, newValue: Value) => void; removeItem: (key: string) => void; delayInit?: boolean; subscribe?: (key: string, callback: (value: Value) => void) => Unsubscribe; } export interface AsyncStringStorage { getItem: (key: string) => Promise; setItem: (key: string, newValue: string) => Promise; removeItem: (key: string) => Promise; } export interface SyncStringStorage { getItem: (key: string) => string | null; setItem: (key: string, newValue: string) => void; removeItem: (key: string) => void; } export declare function createJSONStorage(getStringStorage: () => AsyncStringStorage): AsyncStorage; export declare function createJSONStorage(getStringStorage: () => SyncStringStorage): SyncStorage; export declare function atomWithStorage(key: string, initialValue: Value, storage: AsyncStorage & { delayInit: true; }): WritableAtom, Promise>; export declare function atomWithStorage(key: string, initialValue: Value, storage: AsyncStorage): WritableAtom, SetStateActionWithReset, Promise>; export declare function atomWithStorage(key: string, initialValue: Value, storage: SyncStorage): WritableAtom>; export declare function atomWithStorage(key: string, initialValue: Value): WritableAtom>; export declare function atomWithHash(key: string, initialValue: Value, options?: { serialize?: (val: Value) => string; deserialize?: (str: string | null) => Value | typeof NO_STORAGE_VALUE; delayInit?: boolean; replaceState?: boolean; subscribe?: (callback: () => void) => () => void; }): WritableAtom>; export {};