UNPKG

900 BTypeScriptView Raw
1// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>
2// TypeScript Version: 3.1
3import * as React from 'react';
4import { Theme } from "./@emotion-react-types-index";
5import { DistributiveOmit, PropsOf } from "./@emotion-react-types-helper";
6export interface ThemeProviderProps {
7 theme: Partial<Theme> | ((outerTheme: Theme) => Theme);
8 children?: React.ReactNode;
9}
10export interface ThemeProvider {
11 (props: ThemeProviderProps): React.ReactElement;
12}
13export type withTheme = <C extends React.ComponentType<React.ComponentProps<C>>>(component: C) => React.FC<DistributiveOmit<PropsOf<C>, 'theme'> & {
14 theme?: Theme;
15}>;
16export function useTheme(): Theme;
17export const ThemeProvider: ThemeProvider;
18export const withTheme: withTheme;
19export type WithTheme<P, T> = P extends {
20 theme: infer Theme;
21} ? P & {
22 theme: Exclude<Theme, undefined>;
23} : P & {
24 theme: T;
25};
\No newline at end of file