type AsyncState<T> = {
    loading: boolean;
    value: T | undefined;
    error: Error | undefined;
};
export type AsyncGroupRef = {
    register: (id: string, state: AsyncState<any>) => void;
    unregister: (id: string) => void;
    updateState: (id: string, state: AsyncState<any>) => void;
};
/**
 * Hook to manage and aggregate the state of multiple async handlers.
 * Provides loading state, error tracking, and reset functionality across all registered handlers.
 *
 * @returns An object containing:
 * - `ref`: Reference to pass to useAsyncHandler hooks for registration
 * - `loading`: True if any handler is loading
 * - `error`: The first error from any handler
 * - `errors`: Array of all errors from handlers
 * - `hasError`: True if any handler has an error
 * - `loadingCount`: Number of handlers currently loading
 * - `reset()`: Clear all errors
 * - `resetAll()`: Reset all states to initial values
 *
 * @example
 * const asyncGroup = useAsyncGroup()
 * const [handler] = useAsyncHandler(async () => {...}, [], asyncGroup.ref)
 *
 * return <Button disabled={asyncGroup.loading} onClick={handler} />
 */
export declare const useAsyncGroup: () => {
    loading: boolean;
    error: Error | undefined;
    errors: Error[];
    hasError: boolean;
    loadingCount: number;
    ref: AsyncGroupRef;
    reset: () => void;
};
/**
 * Hook to manage the execution of an async function with loading and error states.
 * Can optionally register with an async group for coordinated state management.
 *
 * @template T - The async function type
 * @param {T} callback - The async function to execute
 * @param {React.DependencyList} deps - Dependency array for the callback (similar to useCallback)
 * @param {AsyncGroupRef} [groupRef] - Optional group reference for coordinated state management
 * @returns {[Function, {loading: boolean, value: Awaited<ReturnType<T>> | undefined, error: Error | undefined, reset: () => void}]}
 *   A tuple containing:
 *   - Handler function to execute the async operation
 *   - State object with loading, value, error, and reset function
 * @example
 * const [handleSubmit, { loading, error }] = useAsyncHandler(
 *   async (data) => await api.submit(data),
 *   [api]
 * )
 */
export declare const useAsyncHandler: <T extends (...args: any[]) => Promise<any>>(callback: T, deps: React.DependencyList, groupRef?: AsyncGroupRef) => [(...args: Parameters<T>) => Promise<void>, {
    loading: boolean;
    value: Awaited<ReturnType<T>> | undefined;
    error: Error | undefined;
    reset: () => void;
}];
export {};
