/** * Represents the state of an asynchronous operation. * * @template T The type of the value returned by the async function. * @template E The type of the error thrown by the async function (defaults to Error). */ interface AsyncState { loading: boolean; error: E | null; value: T | null; } /** * Represents the return value of the useAsync hook. * * @template T The type of the value returned by the async function. * @template E The type of the error thrown by the async function. */ interface UseAsyncReturn extends AsyncState { execute: () => Promise; } /** * Custom hook to manage the state of an asynchronous function call. * * @template T The expected type of the successful result. * @template E The expected type of the error (defaults to Error). * @param {() => Promise} asyncFunction The asynchronous function to execute. * @param {boolean} [immediate=true] Whether to execute the function immediately on mount. Defaults to true. * @returns {UseAsyncReturn} An object containing the loading state, error, value, and an execute function. */ export declare const useAsync: (asyncFunction: () => Promise, immediate?: boolean) => UseAsyncReturn; export {};