@@ -4,17 +4,21 @@ declare module "react-css-themr" {
4
4
type TReactCSSThemrTheme = {
5
5
[ key : string ] : string | TReactCSSThemrTheme
6
6
}
7
+ type TMapThemrProps < P > = ( ownProps : P , theme : TReactCSSThemrTheme ) => P & { theme : TReactCSSThemrTheme }
7
8
8
9
export function themeable ( ...themes : Array < TReactCSSThemrTheme > ) : TReactCSSThemrTheme ;
9
10
10
11
export interface IThemrOptions {
11
12
/** @default "deeply" */
12
13
composeTheme ?: "deeply" | "softly" | false ,
14
+ //currently there's no way to lift decorated component's generic type argument (P) to upper decorator
15
+ //that's why just {}
16
+ mapThemrProps ?: TMapThemrProps < { } >
13
17
}
14
18
15
19
export interface ThemeProviderProps {
16
20
innerRef ?: Function ,
17
- theme : { }
21
+ theme : TReactCSSThemrTheme
18
22
}
19
23
20
24
export class ThemeProvider extends React . Component < ThemeProviderProps , any > {
@@ -31,5 +35,6 @@ declare module "react-css-themr" {
31
35
identifier : string | number | symbol ,
32
36
defaultTheme ?: { } ,
33
37
options ?: IThemrOptions
34
- ) : < P , S > ( component : ( new ( props ?: P , context ?: any ) => React . Component < P , S > ) | React . SFC < P > ) => ThemedComponentClass < P , S > ;
38
+ ) : < P , S > ( component : ( new ( props ?: P , context ?: any ) => React . Component < P , S > ) | React . SFC < P > ) =>
39
+ ThemedComponentClass < P & { mapThemrProps ?: TMapThemrProps < P > } , S > ;
35
40
}
0 commit comments