@gravity-ui/uikit
Version:
Gravity UI base styling and components
11 lines (10 loc) • 524 B
TypeScript
type AnyAsyncAction = (...args: any[]) => PromiseLike<any>;
export interface UseAsyncActionHandlerProps<Action extends AnyAsyncAction> {
handler: Action;
}
export interface UseAsyncActionHandlerResult<Action extends AnyAsyncAction> {
isLoading: boolean;
handler: (...args: Parameters<Action>) => Promise<Awaited<ReturnType<Action>>>;
}
export declare function useAsyncActionHandler<Action extends AnyAsyncAction>({ handler, }: UseAsyncActionHandlerProps<Action>): UseAsyncActionHandlerResult<Action>;
export {};