From aa757e8e6d5f8f9ad60b1ec12c4ac9479be73c80 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Wed, 2 Sep 2020 09:08:01 +0800 Subject: [PATCH] fix(types): fix `this` type of `this.$watch` (#2022) --- packages/runtime-core/src/componentPublicInstance.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/runtime-core/src/componentPublicInstance.ts b/packages/runtime-core/src/componentPublicInstance.ts index 35125ac8..c47941fc 100644 --- a/packages/runtime-core/src/componentPublicInstance.ts +++ b/packages/runtime-core/src/componentPublicInstance.ts @@ -1,6 +1,6 @@ import { ComponentInternalInstance, Data } from './component' import { nextTick, queueJob } from './scheduler' -import { instanceWatch } from './apiWatch' +import { instanceWatch, WatchOptions, WatchStopHandle } from './apiWatch' import { EMPTY_OBJ, hasOwn, @@ -162,7 +162,11 @@ export type ComponentPublicInstance< $options: Options $forceUpdate: ReactiveEffect $nextTick: typeof nextTick - $watch: typeof instanceWatch + $watch( + source: string | Function, + cb: Function, + options?: WatchOptions + ): WatchStopHandle } & P & ShallowUnwrapRef & D &