Merge pull request #276 from dwyanewang/main
fix(useRequest): 修复立即执行时参数类型不匹配的问题
This commit is contained in:
@@ -48,7 +48,7 @@ export default function useRequest<T, P = undefined>(
|
||||
}
|
||||
|
||||
if (options.immediate) {
|
||||
(run as (args: P) => Promise<T | undefined>)({} as P)
|
||||
(run as (args?: P) => Promise<T | undefined>)({} as P)
|
||||
}
|
||||
return { loading, error, data, run }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user