types: refactor watcher types naming

This commit is contained in:
Evan You
2019-12-30 11:30:12 -05:00
parent 1cf1ad5e94
commit bfb0ad5a5e
2 changed files with 24 additions and 24 deletions

View File

@@ -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)
}