|
@@ -1,5 +1,5 @@
|
|
|
import { ErrorCodes, callWithErrorHandling } from './errorHandling'
|
|
import { ErrorCodes, callWithErrorHandling } from './errorHandling'
|
|
|
-import { isArray, NOOP } from '@vue/shared'
|
|
|
|
|
|
|
+import { Awaited, isArray, NOOP } from '@vue/shared'
|
|
|
import { ComponentInternalInstance, getComponentName } from './component'
|
|
import { ComponentInternalInstance, getComponentName } from './component'
|
|
|
import { warn } from './warning'
|
|
import { warn } from './warning'
|
|
|
|
|
|
|
@@ -50,10 +50,10 @@ let currentFlushPromise: Promise<void> | null = null
|
|
|
const RECURSION_LIMIT = 100
|
|
const RECURSION_LIMIT = 100
|
|
|
type CountMap = Map<SchedulerJob, number>
|
|
type CountMap = Map<SchedulerJob, number>
|
|
|
|
|
|
|
|
-export function nextTick<T = void>(
|
|
|
|
|
|
|
+export function nextTick<T = void, R = void>(
|
|
|
this: T,
|
|
this: T,
|
|
|
- fn?: (this: T) => void
|
|
|
|
|
-): Promise<void> {
|
|
|
|
|
|
|
+ fn?: (this: T) => R
|
|
|
|
|
+): Promise<Awaited<R>> {
|
|
|
const p = currentFlushPromise || resolvedPromise
|
|
const p = currentFlushPromise || resolvedPromise
|
|
|
return fn ? p.then(this ? fn.bind(this) : fn) : p
|
|
return fn ? p.then(this ? fn.bind(this) : fn) : p
|
|
|
}
|
|
}
|