types: refactor watcher types naming
This commit is contained in:
@@ -16,7 +16,7 @@ import {
|
||||
NOOP
|
||||
} from '@vue/shared'
|
||||
import { computed } from './apiReactivity'
|
||||
import { watch, WatchOptions, WatchHandler } from './apiWatch'
|
||||
import { watch, WatchOptions, WatchCallback } from './apiWatch'
|
||||
import { provide, inject } from './apiInject'
|
||||
import {
|
||||
onBeforeMount,
|
||||
@@ -133,8 +133,8 @@ export type ExtractComputedReturns<T extends any> = {
|
||||
|
||||
type WatchOptionItem =
|
||||
| string
|
||||
| WatchHandler
|
||||
| { handler: WatchHandler } & WatchOptions
|
||||
| WatchCallback
|
||||
| { handler: WatchCallback } & WatchOptions
|
||||
|
||||
type ComponentWatchOptionItem = WatchOptionItem | WatchOptionItem[]
|
||||
|
||||
@@ -463,7 +463,7 @@ function createWatcher(
|
||||
if (isString(raw)) {
|
||||
const handler = renderContext[raw]
|
||||
if (isFunction(handler)) {
|
||||
watch(getter, handler as WatchHandler)
|
||||
watch(getter, handler as WatchCallback)
|
||||
} else if (__DEV__) {
|
||||
warn(`Invalid watch handler specified by key "${raw}"`, handler)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user