import type { Draft } from "immer"; type StateReducer = (state: Draft, payload: A) => S | void; export type ReducerMap = Record>; type AtomConfig = { initialState: S; reducers: R; }; export type Action

= { type: string; payload: P; }; type Actions = { [Key in keyof C]: C[Key] extends (state: any) => any ? () => Action : C[Key] extends (state: any, payload: infer Payload) => any ? (payload: Payload) => Action : never; }; export type Atom = { initialState: S; reducers: C; action: Actions; }; /** * Creates an atom definition. * * @remarks * An atom is a unit of state with an initial value and a set of reducers. * It does not hold state itself but defines how state is managed. * * @typeParam S - The state type. * @typeParam R - The reducer map type. * @param config - The atom configuration (initialState, reducers). * @returns An atom definition object. * * @example * ```ts * const counterAtom = atom({ * initialState: 0, * reducers: { * increment: (state) => state + 1, * decrement: (state) => state - 1 * } * }); * ``` */ export declare function atom>(config: AtomConfig): Atom; export interface AtomFamily

, S, R extends ReducerMap> { (...args: [...P]): Atom; has(...args: [...P]): boolean; delete(...args: [...P]): boolean; size(): number; } /** * Creates a family of atoms. * * @remarks * An atom family allows creating atoms dynamically based on parameters. * It caches atoms by their parameters. * * @typeParam P - The parameters type (array). * @typeParam S - The state type. * @typeParam R - The reducer map type. * @param factory - A function that returns an atom definition based on parameters. * @returns An atom family function with cache management methods. * * @example * ```ts * const userAtom = atomFamily((id: string) => atom({ * initialState: { id, name: "Loading..." }, * reducers: { ... } * })); * ``` */ export declare function atomFamily

, S, R extends ReducerMap>(factory: (...args: [...P]) => Atom): AtomFamily; export {};