Skip to content

Commit ddb4303

Browse files
Fix: Name the default export for themr typings
fix #74
1 parent 86a32f6 commit ddb4303

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

src/components/themr.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const THEMR_CONFIG =
3333
* @param {{}} [options] - Themr options
3434
* @returns {function(ThemedComponent:Function):Function} - ThemedComponent
3535
*/
36-
export default (componentName, localTheme, options = {}) => ThemedComponent => {
36+
const themr = (componentName, localTheme, options = {}) => ThemedComponent => {
3737
const {
3838
composeTheme: optionComposeTheme,
3939
mapThemrProps: optionMapThemrProps
@@ -177,6 +177,7 @@ export default (componentName, localTheme, options = {}) => ThemedComponent => {
177177

178178
return hoistNonReactStatics(Themed, ThemedComponent)
179179
}
180+
export default themr;
180181

181182
/**
182183
* Merges passed themes by concatenating string keys and processing nested themes

types/components/ThemeProvider.d.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
export default class ThemeProvider extends Component<any, any, any> {
22
static propTypes: {
3-
children: any;
4-
theme: any;
3+
children: PropTypes.Validator<PropTypes.ReactElementLike>;
4+
theme: PropTypes.Validator<object>;
55
};
66
static defaultProps: {
77
theme: {};
88
};
99
static childContextTypes: {
10-
themr: any;
10+
themr: PropTypes.Validator<PropTypes.InferProps<{
11+
theme: PropTypes.Validator<object>;
12+
}>>;
1113
};
1214
constructor(props: Readonly<any>);
1315
constructor(props: any, context?: any);
@@ -18,3 +20,4 @@ export default class ThemeProvider extends Component<any, any, any> {
1820
};
1921
}
2022
import { Component } from "react";
23+
import PropTypes from "prop-types";

types/components/themr.d.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
* @returns {TReactCSSThemrTheme} - Resulting theme
66
*/
77
export function themeable(...themes: TReactCSSThemrTheme[]): any;
8-
declare function _default(componentName: string | number | Symbol, localTheme?: any, options?: {}): (arg0: any, arg1: Function) => Function;
9-
export default _default;
8+
export default themr;
109
export type TReactCSSThemrTheme = any;
1110
export type TReactCSSThemrOptions = {};
11+
/**
12+
* Themr decorator
13+
* @param {String|Number|Symbol} componentName - Component name
14+
* @param {TReactCSSThemrTheme} [localTheme] - Base theme
15+
* @param {{}} [options] - Themr options
16+
* @returns {function(ThemedComponent:Function):Function} - ThemedComponent
17+
*/
18+
declare function themr(componentName: string | number | Symbol, localTheme?: any, options?: {}): (arg0: any, arg1: Function) => Function;

types/utils/themr-shape.d.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
declare var _default: any;
1+
declare var _default: PropTypes.Requireable<PropTypes.InferProps<{
2+
theme: PropTypes.Validator<object>;
3+
}>>;
24
export default _default;
5+
import PropTypes from "prop-types";

0 commit comments

Comments
 (0)