UNPKG

508 BTypeScriptView Raw
1import { Theme } from './createTheme';
2import { Components } from './components';
3
4export interface ThemeWithProps {
5 components?: Components<Omit<Theme, 'components'>>;
6}
7
8export type ThemedProps<Theme, Name extends keyof any> = Theme extends {
9 components: Record<Name, { defaultProps: infer Props }>;
10}
11 ? Props
12 : {};
13
14export default function useThemeProps<
15 Theme extends ThemeWithProps,
16 Props,
17 Name extends keyof any,
18>(params: { props: Props; name: Name }): Props & ThemedProps<Theme, Name>;