Skip to content

Commit 09ae9bd

Browse files
feat: add generics to StyleProp type (#19)
1 parent 97affb7 commit 09ae9bd

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

src/types.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,31 @@ interface IBaseCssValue<T> {
55
base?: T;
66
}
77

8-
export type StyleProps<T> = T extends (props: infer R) => any
8+
export type InferPropsFromFunctionArgument<T> = T extends (
9+
props: infer R,
10+
) => any
911
? R extends { theme?: any } ? Pick<R, Exclude<keyof R, 'theme'>> : R
10-
: never;
12+
: {};
13+
14+
export type StyleProps<
15+
T1,
16+
T2 = {},
17+
T3 = {},
18+
T4 = {},
19+
T5 = {},
20+
T6 = {},
21+
T7 = {},
22+
T8 = {},
23+
T9 = {}
24+
> = InferPropsFromFunctionArgument<T1> &
25+
InferPropsFromFunctionArgument<T2> &
26+
InferPropsFromFunctionArgument<T3> &
27+
InferPropsFromFunctionArgument<T4> &
28+
InferPropsFromFunctionArgument<T5> &
29+
InferPropsFromFunctionArgument<T6> &
30+
InferPropsFromFunctionArgument<T7> &
31+
InferPropsFromFunctionArgument<T8> &
32+
InferPropsFromFunctionArgument<T9>;
1133

1234
export type ResponsivePropValue<BreakPoints, ValueType> = {
1335
[P in Extract<keyof BreakPoints, string>]?: ValueType

0 commit comments

Comments
 (0)