type AsyncCallback> = (...args: [...Args, AbortController["signal"]]) => Promise; type UseAsyncCallback, Error> = [ (...args: [...Args]) => void, { loading: boolean; error: Error | null; } ]; /** * Wraps an async function with loading and error state, and handles cancellation. * * @remarks * The callback receives an `AbortSignal` as its last argument. * Previous executions are aborted when a new one starts. * * @typeParam Args - The arguments of the async function. * @typeParam Error - The error type. * @param fn - The async function to wrap. * @returns A tuple `[callback, state]`. * * @example * ```tsx * const [fetchData, { loading, error }] = useAsyncCallback(async (id: string, signal) => { * const response = await fetch(`/api/${id}`, { signal }); * // ... * }); * ``` */ export declare function useAsyncCallback, Error = unknown>(fn: AsyncCallback): UseAsyncCallback; export {};