From: Cr <631807682@qq.com> Date: Sat, 12 Oct 2019 14:30:21 +0000 (+0800) Subject: types: add missing properties to ComponentPublicInstance interface (#218) X-Git-Tag: v3.0.0-alpha.0~478 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f3760f7d34b8aeeebd96bf224d805b22baf6c11f;p=thirdparty%2Fvuejs%2Fcore.git types: add missing properties to ComponentPublicInstance interface (#218) --- diff --git a/packages/runtime-core/src/apiWatch.ts b/packages/runtime-core/src/apiWatch.ts index ebbe33c215..927db33321 100644 --- a/packages/runtime-core/src/apiWatch.ts +++ b/packages/runtime-core/src/apiWatch.ts @@ -209,7 +209,7 @@ export function instanceWatch( source: string | Function, cb: Function, options?: WatchOptions -): () => void { +): StopHandle { const ctx = this.renderProxy! const getter = isString(source) ? () => ctx[source] : source.bind(ctx) const stop = watch(getter, cb.bind(ctx), options) diff --git a/packages/runtime-core/src/componentProxy.ts b/packages/runtime-core/src/componentProxy.ts index b175a8386d..01324d2c0e 100644 --- a/packages/runtime-core/src/componentProxy.ts +++ b/packages/runtime-core/src/componentProxy.ts @@ -3,7 +3,7 @@ import { nextTick } from './scheduler' import { instanceWatch } from './apiWatch' import { EMPTY_OBJ, hasOwn, globalsWhitelist } from '@vue/shared' import { ExtractComputedReturns } from './apiOptions' -import { UnwrapRef } from '@vue/reactivity' +import { UnwrapRef, ReactiveEffect } from '@vue/reactivity' import { warn } from './warning' // public properties exposed on the proxy, which is used as the render context @@ -25,6 +25,11 @@ export type ComponentPublicInstance< $root: ComponentInternalInstance | null $parent: ComponentInternalInstance | null $emit: (event: string, ...args: unknown[]) => void + $el: any + $options: any + $forceUpdate: ReactiveEffect + $nextTick: typeof nextTick + $watch: typeof instanceWatch } & P & UnwrapRef & D &