@@ -21,3 +21,39 @@ export type SizeType = ResponsiveValue<
21
21
export type ColorType = ResponsiveValue <
22
22
Leaves < ITheme [ 'colors' ] > | ( string & { } )
23
23
> ;
24
+
25
+ type ComponentType < T extends keyof ITheme [ 'components' ] > = {
26
+ [ Property in keyof ITheme [ 'components' ] [ T ] ] : ITheme [ 'components' ] [ T ] [ Property ] ;
27
+ } ;
28
+
29
+ type ParametersOf < T > = {
30
+ [ Key in keyof T ] : T [ Key ] extends ( ...args : any ) => void
31
+ ? Parameters < T [ Key ] > [ 0 ] extends { }
32
+ ? Parameters < T [ Key ] > [ 0 ]
33
+ : never
34
+ : never ;
35
+ } [ keyof T ] ;
36
+
37
+ // type VariantParams<T extends keyof ITheme['components']> = ParametersOf<
38
+ // //@ts -ignore
39
+ // ComponentType<T>['variants']
40
+ // >;
41
+
42
+ // type PickedVariantParams<T extends keyof ITheme['components']> = Pick<
43
+ // VariantParams<T>,
44
+ // keyof VariantParams<T>
45
+ // >;
46
+ type ParameterType < T , Key > = ParametersOf <
47
+ //@ts -ignore
48
+ ComponentType < T > [ Key ]
49
+ > ;
50
+ type CustomPropType < T extends keyof ITheme [ 'components' ] , Key > = Extract <
51
+ ParameterType < T , Key > ,
52
+ Pick < ParameterType < T , Key > , keyof ParameterType < T , Key > >
53
+ > ;
54
+
55
+ export type CustomProps < T extends keyof ITheme [ 'components' ] > =
56
+ | CustomPropType < T , 'variants' >
57
+ | CustomPropType < T , 'baseStyle' >
58
+ | CustomPropType < T , 'sizes' >
59
+ | CustomPropType < T , 'defaultProps' > ;
0 commit comments