11import { ExtractDefaultPropTypes , ExtractPropTypes } from './componentProps'
2- import { ShallowUnwrapRef } from '..'
2+ import {
3+ nextTick ,
4+ ShallowUnwrapRef ,
5+ UnwrapNestedRefs ,
6+ WatchOptions ,
7+ WatchStopHandle ,
8+ } from '..'
39import { Data } from './common'
410
511import Vue , {
@@ -11,6 +17,12 @@ import {
1117 MethodOptions ,
1218 ExtractComputedReturns ,
1319} from './componentOptions'
20+ import {
21+ ComponentInternalInstance ,
22+ EmitFn ,
23+ EmitsOptions ,
24+ Slots ,
25+ } from '../runtimeContext'
1426
1527export type ComponentInstance = InstanceType < VueConstructor >
1628
@@ -79,3 +91,42 @@ export type VueProxy<
7991 ExtractPropTypes < PropsOptions >
8092> &
8193 VueConstructorProxy < PropsOptions , RawBindings , Data , Computed , Methods >
94+
95+ // public properties exposed on the proxy, which is used as the render context
96+ // in templates (as `this` in the render option)
97+ export type ComponentPublicInstance <
98+ P = { } , // props type extracted from props option
99+ B = { } , // raw bindings returned from setup()
100+ D = { } , // return from data()
101+ C extends ComputedOptions = { } ,
102+ M extends MethodOptions = { } ,
103+ E extends EmitsOptions = { } ,
104+ PublicProps = P ,
105+ Defaults = { } ,
106+ MakeDefaultsOptional extends boolean = false
107+ > = {
108+ $ : ComponentInternalInstance
109+ $data : D
110+ $props : MakeDefaultsOptional extends true
111+ ? Partial < Defaults > & Omit < P & PublicProps , keyof Defaults >
112+ : P & PublicProps
113+ $attrs : Data
114+ $refs : Data
115+ $slots : Slots
116+ $root : ComponentPublicInstance | null
117+ $parent : ComponentPublicInstance | null
118+ $emit : EmitFn < E >
119+ $el : any
120+ // $options: Options & MergedComponentOptionsOverride
121+ $forceUpdate : ( ) => void
122+ $nextTick : typeof nextTick
123+ $watch (
124+ source : string | Function ,
125+ cb : Function ,
126+ options ?: WatchOptions
127+ ) : WatchStopHandle
128+ } & P &
129+ ShallowUnwrapRef < B > &
130+ UnwrapNestedRefs < D > &
131+ ExtractComputedReturns < C > &
132+ M
0 commit comments