UNPKG

ahooks

Version:
8 lines (7 loc) 735 B
import type { Options, Plugin, Result, Service } from './types'; type AnyService = (...args: any[]) => Promise<any>; type InferData<TService extends AnyService> = Awaited<ReturnType<TService>>; type InferParams<TService extends AnyService> = Parameters<TService>; declare function useRequest<TService extends AnyService>(service: TService, options?: Options<InferData<TService>, InferParams<TService>>, plugins?: Plugin<InferData<TService>, InferParams<TService>>[]): Result<InferData<TService>, InferParams<TService>>; declare function useRequest<TData, TParams extends any[]>(service: Service<TData, TParams>, options?: Options<TData, TParams>, plugins?: Plugin<TData, TParams>[]): Result<TData, TParams>; export default useRequest;