@@ -115,20 +115,23 @@ export type ComponentInstance<T> = T extends { new (): ComponentPublicInstance }
115115 : T extends FunctionalComponent < infer Props , infer Emits >
116116 ? ComponentPublicInstance < Props , { } , { } , { } , { } , ShortEmitsToObject < Emits > >
117117 : T extends Component <
118- infer Props ,
118+ infer PropsOrInstance ,
119119 infer RawBindings ,
120120 infer D ,
121121 infer C ,
122122 infer M
123123 >
124- ? // NOTE we override Props/RawBindings/D to make sure is not `unknown`
125- ComponentPublicInstance <
126- unknown extends Props ? { } : Props ,
127- unknown extends RawBindings ? { } : RawBindings ,
128- unknown extends D ? { } : D ,
129- C ,
130- M
131- >
124+ ? PropsOrInstance extends { $props : unknown }
125+ ? // T is returned by `defineComponent()`
126+ PropsOrInstance
127+ : // NOTE we override Props/RawBindings/D to make sure is not `unknown`
128+ ComponentPublicInstance <
129+ unknown extends PropsOrInstance ? { } : PropsOrInstance ,
130+ unknown extends RawBindings ? { } : RawBindings ,
131+ unknown extends D ? { } : D ,
132+ C ,
133+ M
134+ >
132135 : never // not a vue Component
133136
134137/**
@@ -259,16 +262,16 @@ export type ConcreteComponent<
259262 * The constructor type is an artificial type returned by defineComponent().
260263 */
261264export type Component <
262- Props = any ,
265+ PropsOrInstance = any ,
263266 RawBindings = any ,
264267 D = any ,
265268 C extends ComputedOptions = ComputedOptions ,
266269 M extends MethodOptions = MethodOptions ,
267270 E extends EmitsOptions | Record < string , any [ ] > = { } ,
268271 S extends Record < string , any > = any ,
269272> =
270- | ConcreteComponent < Props , RawBindings , D , C , M , E , S >
271- | ComponentPublicInstanceConstructor < Props >
273+ | ConcreteComponent < PropsOrInstance , RawBindings , D , C , M , E , S >
274+ | ComponentPublicInstanceConstructor < PropsOrInstance >
272275
273276export type { ComponentOptions }
274277
0 commit comments