Skip to content

Commit e38b48b

Browse files
committed
Fix ThemeProvider components prop type
1 parent 0c4ad67 commit e38b48b

File tree

3 files changed

+721
-3
lines changed

3 files changed

+721
-3
lines changed

packages/theme-provider/src/index.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
jsx,
33
useThemeUI,
44
ThemeProvider as CoreProvider,
5+
ThemeProviderProps as CoreThemeProviderProps,
56
IntrinsicSxElements,
67
} from '@theme-ui/core'
78
import { css, Theme } from '@theme-ui/css'
@@ -33,10 +34,16 @@ const BodyStyles = () =>
3334
},
3435
})
3536

36-
interface ThemeProviderProps {
37-
theme: Theme
37+
type ProvidedComponentsKnownKeys = {
38+
[key in keyof IntrinsicSxElements]?: React.ComponentType<any> | string
39+
}
40+
export interface ProvidedComponents extends ProvidedComponentsKnownKeys {
41+
[key: string]: React.ComponentType<any> | string | undefined
42+
}
43+
44+
interface ThemeProviderProps extends Pick<CoreThemeProviderProps, 'theme'> {
3845
children?: React.ReactNode
39-
components?: { [key in keyof IntrinsicSxElements]?: React.ReactNode }
46+
components?: ProvidedComponents
4047
}
4148

4249
export const ThemeProvider: React.FC<ThemeProviderProps> = ({

0 commit comments

Comments
 (0)