import type { Atom, ReducerMap } from "./atom"; import type { Selector } from "./selector"; type Comparator = (prevState: S, state: S) => boolean; /** * Subscribes to the state of an atom. * * @typeParam S - The state type. * @param atom - The atom to subscribe to. * @param comparator - Optional comparator function to determine if state has changed. * @returns The current state of the atom. */ export declare function useAtomState(atom: Atom, comparator?: Comparator): S; type UseSetAtom> = { [Key in keyof R]: R[Key] extends (state: any, payload: infer P) => any ? (payload: P) => void : never; }; /** * Returns the action creators (mutators) for an atom. * * @typeParam R - The reducer map type. * @param atom - The atom definition. * @returns An object containing functions to dispatch actions. */ export declare function useSetAtom>(atom: Atom): UseSetAtom; /** * A combined hook that returns both state and mutators. * * @typeParam S - The state type. * @typeParam R - The reducer map type. * @param atom - The atom definition. * @returns A tuple `[state, actions]`. */ export declare function useAtom>(atom: Atom): readonly [S, UseSetAtom]; /** * Runs a side effect whenever the atom's state changes. * * @typeParam S - The state type. * @typeParam R - The reducer map type. * @param atom - The atom to observe. * @param callback - The function to call with the new state. */ export declare function useAtomEffect>(atom: Atom, callback: (state: S) => void): void; /** * Selects derived state from multiple atoms. * * @typeParam A - The array of atoms. * @typeParam R - The return type of the selector. * @param selector - The selector definition. * @returns The derived state. */ export declare function useSelector>, R>(selector: Selector): R; /** * Returns state, mutators, and a pending indicator, wrapping updates in `startTransition`. * * @typeParam S - The state type. * @typeParam R - The reducer map type. * @param atom - The atom definition. * @returns A tuple `[state, actions, isPending]`. */ export declare function useTransitionAtom>(atom: Atom): readonly [S, { [k: string]: (payload: any) => void; }, boolean]; export {};