From c96f84e148bdd075d6f46c945807f40bcb5359d2 Mon Sep 17 00:00:00 2001 From: Kirill Agalakov Date: Fri, 12 May 2017 14:31:44 +0300 Subject: [PATCH 1/2] add typing to new feature: mapThemrProps --- index.d.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index 7a4e6ec..337799d 100644 --- a/index.d.ts +++ b/index.d.ts @@ -4,17 +4,21 @@ declare module "react-css-themr" { type TReactCSSThemrTheme = { [key: string]: string | TReactCSSThemrTheme } + type TMapThemrProps

= (ownProps: P, theme: TReactCSSThemrTheme) => P & { theme: TReactCSSThemrTheme } export function themeable(...themes: Array): TReactCSSThemrTheme; export interface IThemrOptions { /** @default "deeply" */ composeTheme?: "deeply" | "softly" | false, + //currently there's no way to lift decorated component's generic type argument (P) to upper decorator + //that's why just {} + mapThemrProps?: TMapThemrProps<{}> } export interface ThemeProviderProps { innerRef?: Function, - theme: {} + theme: TReactCSSThemrTheme } export class ThemeProvider extends React.Component { @@ -31,5 +35,6 @@ declare module "react-css-themr" { identifier: string | number | symbol, defaultTheme?: {}, options?: IThemrOptions - ): (component: (new(props?: P, context?: any) => React.Component) | React.SFC

) => ThemedComponentClass; + ): (component: (new(props?: P, context?: any) => React.Component) | React.SFC

) => + ThemedComponentClass

}, S>; } From ee839eb10693cd360119058a4dbdedd85fee2a50 Mon Sep 17 00:00:00 2001 From: Kirill Agalakov Date: Fri, 12 May 2017 14:38:20 +0300 Subject: [PATCH 2/2] fix --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 337799d..b37454b 100644 --- a/index.d.ts +++ b/index.d.ts @@ -36,5 +36,5 @@ declare module "react-css-themr" { defaultTheme?: {}, options?: IThemrOptions ): (component: (new(props?: P, context?: any) => React.Component) | React.SFC

) => - ThemedComponentClass

}, S>; + ThemedComponentClass

}, S>; }