File tree 2 files changed +15
-7
lines changed 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'
8
8
export { useClassAndStyle , camelizePropKey } from './composables'
9
9
export * from './types'
10
10
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 > ,
13
17
extraOptions ?: ComponentOptions ,
14
- ) : ComponentType < T > {
18
+ ) : ComponentType < T , S , M > {
15
19
const fn : FunctionalComponent = ( _props , ctx ) => {
16
20
const props = useProps ( )
17
- return comp ( props as any , ctx )
21
+ return comp ( props as any , ctx as any )
18
22
}
19
23
Object . keys ( comp ) . forEach ( ( key ) => {
20
24
// @ts -expect-error
Original file line number Diff line number Diff line change @@ -24,11 +24,15 @@ export type ExtractSlots<T> = {
24
24
[ P in keyof T as RemovePrefix < string & P , 'render' > ] : T [ P ]
25
25
}
26
26
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 <
28
32
ExtractProps < T > ,
29
33
ExtractEvent < T > ,
30
- SlotsType < ExtractSlots < T > >
31
- >
34
+ SlotsType < ExtractSlots < T > & S >
35
+ > & { new ( ) : Expose }
32
36
33
37
type IfAny < T , Y , N > = 0 extends 1 & T ? Y : N
34
38
export interface FunctionalComponent <
You can’t perform that action at this time.
0 commit comments