File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -8,13 +8,17 @@ import { useProps } from './composables'
88export { useClassAndStyle , camelizePropKey } from './composables'
99export * from './types'
1010
11- export function defineComponent < T extends Record < any , any > > (
12- comp : FunctionalComponent < T , any , any > ,
11+ export function defineComponent <
12+ T extends Record < any , any > ,
13+ S extends Record < any , any > = { } ,
14+ M extends Record < any , any > = { } ,
15+ > (
16+ comp : FunctionalComponent < T , any , S > ,
1317 extraOptions ?: ComponentOptions ,
14- ) : ComponentType < T > {
18+ ) : ComponentType < T , S , M > {
1519 const fn : FunctionalComponent = ( _props , ctx ) => {
1620 const props = useProps ( )
17- return comp ( props as any , ctx )
21+ return comp ( props as any , ctx as any )
1822 }
1923 Object . keys ( comp ) . forEach ( ( key ) => {
2024 // @ts -expect-error
Original file line number Diff line number Diff line change @@ -24,11 +24,15 @@ export type ExtractSlots<T> = {
2424 [ P in keyof T as RemovePrefix < string & P , 'render' > ] : T [ P ]
2525}
2626
27- export type ComponentType < T extends Record < any , any > > = DefineSetupFnComponent <
27+ export type ComponentType <
28+ T extends Record < any , any > ,
29+ S extends Record < any , any > ,
30+ Expose extends Record < any , any > ,
31+ > = DefineSetupFnComponent <
2832 ExtractProps < T > ,
2933 ExtractEvent < T > ,
30- SlotsType < ExtractSlots < T > >
31- >
34+ SlotsType < ExtractSlots < T > & S >
35+ > & { new ( ) : Expose }
3236
3337type IfAny < T , Y , N > = 0 extends 1 & T ? Y : N
3438export interface FunctionalComponent <
You can’t perform that action at this time.
0 commit comments