type Getter = { (atom: Atom>): Value; (atom: Atom>): Value; (atom: Atom): Awaited; }; type WriteGetter = Getter & { (atom: Atom>, options: { unstable_promise: true; }): Promise | Value; (atom: Atom>, options: { unstable_promise: true; }): Promise | Value; (atom: Atom, options: { unstable_promise: true; }): Promise> | Awaited; }; type Setter = { >(atom: WritableAtom): Result; >(atom: WritableAtom, update: Update): Result; }; type Read = (get: Getter) => Value; type Write> = (get: WriteGetter, set: Setter, update: Update) => Result; type WithInitialValue = { init: Value; }; export type SetAtom> = undefined extends Update ? (update?: Update) => Result : (update: Update) => Result; type OnUnmount = () => void; type OnMount> = >(setAtom: S) => OnUnmount | void; export interface Atom { toString: () => string; debugLabel?: string; read: Read; } export interface WritableAtom = void> extends Atom { write: Write; onMount?: OnMount; } type SetStateAction = Value | ((prev: Value) => Value); export type PrimitiveAtom = WritableAtom>; export declare function atom = void>(read: Read, write: Write): WritableAtom; export declare function atom(read: Read): Atom; export declare function atom(invalidFunction: (...args: any) => any, write?: any): never; export declare function atom = void>(initialValue: Value, write: Write): WritableAtom & WithInitialValue; export declare function atom(initialValue: Value): PrimitiveAtom & WithInitialValue; export {};