import type { WritableAtom } from 'jotai/vanilla'; import { RESET } from './constants'; type Unsubscribe = () => void; type Subscribe = (key: string, callback: (value: Value) => void, initialValue: Value) => Unsubscribe | undefined; type StringSubscribe = (key: string, callback: (value: string | null) => void) => Unsubscribe | undefined; type SetStateActionWithReset = Value | typeof RESET | ((prev: Value) => Value | typeof RESET); export interface AsyncStorage { getItem: (key: string, initialValue: Value) => PromiseLike; setItem: (key: string, newValue: Value) => PromiseLike; removeItem: (key: string) => PromiseLike; subscribe?: Subscribe; } export interface SyncStorage { getItem: (key: string, initialValue: Value) => Value; setItem: (key: string, newValue: Value) => void; removeItem: (key: string) => void; subscribe?: Subscribe; } export interface AsyncStringStorage { getItem: (key: string) => PromiseLike; setItem: (key: string, newValue: string) => PromiseLike; removeItem: (key: string) => PromiseLike; subscribe?: StringSubscribe; } export interface SyncStringStorage { getItem: (key: string) => string | null; setItem: (key: string, newValue: string) => void; removeItem: (key: string) => void; subscribe?: StringSubscribe; } export declare function withStorageValidator(validator: (value: unknown) => value is Value): { (storage: AsyncStorage): AsyncStorage; (storage: SyncStorage): SyncStorage; }; type JsonStorageOptions = { reviver?: (key: string, value: unknown) => unknown; replacer?: (key: string, value: unknown) => unknown; }; export declare function createJSONStorage(): SyncStorage; export declare function createJSONStorage(getStringStorage: () => AsyncStringStorage, options?: JsonStorageOptions): AsyncStorage; export declare function createJSONStorage(getStringStorage: () => SyncStringStorage, options?: JsonStorageOptions): SyncStorage; export declare function atomWithStorage(key: string, initialValue: Value, storage: AsyncStorage, options?: { getOnInit?: boolean; }): WritableAtom, [ SetStateActionWithReset> ], Promise>; export declare function atomWithStorage(key: string, initialValue: Value, storage?: SyncStorage, options?: { getOnInit?: boolean; }): WritableAtom ], void>; export {}; declare type Awaited = T extends Promise ? V : T;