فهرست منبع

fix(types): fix `this` type of `this.$watch` (#2022)

Carter Li 5 سال پیش
والد
کامیت
aa757e8e6d
1فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 6 2
      packages/runtime-core/src/componentPublicInstance.ts

+ 6 - 2
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<B> &
   D &