@@ -68,19 +68,27 @@ export type DefineComponent<
6868 _EE extends string = string ,
6969 _PP = PublicProps ,
7070 _Props = ResolveProps < OptionsOrPropsOrPropOptions , E > ,
71- _Defaults = ExtractDefaultPropTypes < OptionsOrPropsOrPropOptions > ,
71+ Defaults = ExtractDefaultPropTypes < OptionsOrPropsOrPropOptions > ,
7272 S extends SlotsType = { } ,
7373 LC extends Record < string , Component > = { } ,
7474 Directives extends Record < string , Directive > = { } ,
7575 Exposed extends string = string ,
7676 Provide extends ComponentProvideOptions = ComponentProvideOptions ,
77- _MakeDefaultsOptional extends boolean = true ,
77+ MakeDefaultsOptional extends boolean = true ,
7878 TypeRefs extends Record < string , unknown > = { } ,
7979 TypeEl extends Element = any ,
80- > = InferComponentOptions <
81- OptionsOrPropsOrPropOptions extends { props ?: any }
82- ? OptionsOrPropsOrPropOptions
83- : {
80+ > = OptionsOrPropsOrPropOptions extends {
81+ props ?: any
82+ __typeProps ?: infer TypeProps
83+ }
84+ ? InferComponentOptions <
85+ OptionsOrPropsOrPropOptions ,
86+ // MakeDefaultsOptional - if TypeProps is provided, set to false to use
87+ // user props types verbatim
88+ unknown extends TypeProps ? true : false
89+ >
90+ : InferComponentOptions <
91+ {
8492 props ?: OptionsOrPropsOrPropOptions extends ComponentPropsOptions
8593 ? OptionsOrPropsOrPropOptions
8694 : { }
@@ -101,10 +109,16 @@ export type DefineComponent<
101109 : OptionsOrPropsOrPropOptions
102110 __typeRefs ?: TypeRefs
103111 __typeEl ?: TypeEl
104- }
105- >
112+ } ,
113+ MakeDefaultsOptional ,
114+ Defaults
115+ >
106116
107- type InferComponentOptions < T > = T &
117+ type InferComponentOptions <
118+ T ,
119+ MakeDefaultsOptional extends boolean ,
120+ Defaults = { } ,
121+ > = T &
108122 ( T extends {
109123 props ?: infer PropsOptions
110124 emits ?: infer RuntimeEmitsOptions
@@ -182,12 +196,13 @@ type InferComponentOptions<T> = T &
182196 : { } ) &
183197 TypeEmitsToOptions < TypeEmits & { } > ,
184198 PublicProps ,
185- ExtractDefaultPropTypes <
186- ExtractMixinProps < Mixin > & ExtractMixinProps < Extends > & PropsOptions
187- > ,
188- // MakeDefaultsOptional - if TypeProps is provided, set to false to use
189- // user props types verbatim
190- unknown extends TypeProps ? true : false ,
199+ Defaults &
200+ ExtractDefaultPropTypes <
201+ ExtractMixinProps < Mixin > &
202+ ExtractMixinProps < Extends > &
203+ PropsOptions
204+ > ,
205+ MakeDefaultsOptional ,
191206 { } ,
192207 { } , // InjectOptions
193208 Slots & { } ,
0 commit comments