Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import hoistNonReactStatics = require('./hoist-non-react-statics');
type $Without<T, K extends keyof any> = T extends any ? Pick<T, Exclude<keyof T, K>> : never;
type $DeepPartial<T> = { [P in keyof T]?: $DeepPartial<T[P]> };

export type ThemedComponent<Theme, Props extends { theme: Theme }> = React.ComponentType<
$Without<Props, 'theme'> & { theme?: $DeepPartial<Theme> }
> & hoistNonReactStatics.NonReactStatics<typeof WrappedComponent>;

export type ThemingType<Theme> = {
ThemeProvider: React.ComponentType<{ theme?: Theme }>;
withTheme: <Props extends { theme: Theme }, C>(
WrappedComponent: React.ComponentType<Props> & C
) => React.ComponentType<
$Without<Props, 'theme'> & { theme?: $DeepPartial<Theme> }
> &
hoistNonReactStatics.NonReactStatics<typeof WrappedComponent>;
) => ThemedComponent<Theme, Props>
useTheme<T = Theme>(overrides?: $DeepPartial<T>): T;
};

Expand Down