fix(utils/create-async-process): improve types

This commit is contained in:
Sándor Levcsák 2020-10-23 07:29:39 +03:00
parent 5536219365
commit d5bf11a8cd
1 changed files with 2 additions and 2 deletions

View File

@ -1,9 +1,9 @@
import { ref } from 'vue'
export default function createAsyncProcess<T extends (...args: any) => Promise<any>> (fn: T) {
export default function createAsyncProcess<T extends (...args: any[]) => any> (fn: T) {
const active = ref<boolean>(false)
async function run (...args : any): Promise<ReturnType<T>> {
async function run (...args : Parameters<T>): Promise<ReturnType<T>> {
active.value = true
const result = await fn(...args)
active.value = false