declare type Getter = { (atom: Atom>): Value; (atom: Atom>): Value; (atom: Atom): Value; }; declare type WriteGetter = Getter & { (atom: Atom>, unstable_promise: true): Value | Promise; (atom: Atom>, unstable_promise: true): Value | Promise; (atom: Atom, unstable_promise: true): Value | Promise; }; declare type Setter = { (atom: WritableAtom): void; (atom: WritableAtom, update: Update): void; }; declare type Read = (get: Getter) => Value | Promise; declare type Write = (get: WriteGetter, set: Setter, update: Update) => void | Promise; declare type WithInitialValue = { init: Value; }; export declare type Scope = symbol | string | number; export declare type SetAtom = undefined extends Update ? (update?: Update) => void : (update: Update) => void; declare type OnUnmount = () => void; declare type OnMount = >(setAtom: S) => OnUnmount | void; export declare type Atom = { toString: () => string; debugLabel?: string; /** * @deprecated Instead use `useAtom(atom, scope)` */ scope?: Scope; read: Read; }; export declare type WritableAtom = Atom & { write: Write; onMount?: OnMount; }; declare type SetStateAction = Value | ((prev: Value) => Value); export declare type PrimitiveAtom = WritableAtom>; export declare function atom(read: Read, write: Write): WritableAtom; export declare function atom(initialValue: Value, write: Write): [Value] extends [Function] ? never : WritableAtom & WithInitialValue; export declare function atom(read: Read): Atom; export declare function atom(initialValue: Value): [Value] extends [Function] ? never : PrimitiveAtom & WithInitialValue; export {};