type JSONValue = string | number | boolean | JSONObject | JSONArray; interface JSONObject { readonly [x: string]: JSONValue; } type ToPrimitive = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T; export type AtomStorage = { readonly setItem: (key: string, value: string) => void; readonly getItem: (key: string) => string | null; }; export type AtomAsyncStorage = { readonly setItem: (key: string, value: string) => Promise; readonly getItem: (key: string) => Promise; }; interface JSONArray extends Array { } export declare class Atom { #private; constructor(initialValue: T); get value(): T; get(): T; addListener(cb: (newVal: T, prevVal: T) => void): { remove: () => void; }; set(value: (T | ((val: T) => T))): void; } export declare function createAtom(initialValue: ToPrimitive): Atom>; export declare function useAtom(atom: Atom): T; export declare function persistAtom(atom: Atom, key: string, Storage: TStorage, opts?: { readonly debounce?: number; }): TStorage extends AtomAsyncStorage ? Promise : T | null; export {};