/** * Configuration options for `usePromiseFactory` hook. */ export interface UsePromiseFactoryOptions { /** * If true, promise factory will automatically be called in a useEffect. * Allows deferring the load until a condition is met or for cases where we * want to load explicitly via the returned `reload` function. * Defaults to true. */ autoLoad?: boolean; } /** * Return type of `usePromiseFactory` hook. */ export interface UsePromiseFactoryResult { /** Data from resolved promise. Will be null if promise fails or has not completed. */ data: T | null; /** Error or error string if promise fails. */ error: Error | string | null; /** true if promise fails. */ isError: boolean; /** true if promise is pending. */ isLoading: boolean; /** Reload the promise factory. */ reload: () => Promise; } /** * Manages the result of a promise factory function in a synchronous way. * @param promiseFactory The factory function which creates the promise to be awaited. * @param args arguments to pass to the factory function. * @returns object containing resolved data or error information. */ export default function usePromiseFactory(promiseFactory: (...args: TArgs) => Promise, args?: TArgs, { autoLoad }?: UsePromiseFactoryOptions): UsePromiseFactoryResult; //# sourceMappingURL=usePromiseFactory.d.ts.map