Skip to content

Commit 40e45d0

Browse files
committed
(core) Make initial theme value {} instead of null
1 parent 1f37123 commit 40e45d0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/core/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ export const jsx: typeof React.createElement = (type, props, ...children) =>
3939

4040
export interface ContextValue {
4141
__EMOTION_VERSION__: string
42-
theme: Theme | null
42+
theme: Theme
4343
colorMode?: string
4444
setColorMode?: () => void
4545
}
4646
export const Context = React.createContext<ContextValue>({
4747
__EMOTION_VERSION__,
48-
theme: null,
48+
theme: {},
4949
})
5050

5151
export const useThemeUI = () => React.useContext(Context)
@@ -78,7 +78,7 @@ interface BaseProviderProps {
7878
const BaseProvider: React.FC<BaseProviderProps> = ({ context, children }) =>
7979
jsx(
8080
EmotionContext.Provider,
81-
{ value: context.theme! },
81+
{ value: context.theme },
8282
jsx(Context.Provider, {
8383
value: context,
8484
children,
@@ -105,7 +105,7 @@ export function ThemeProvider({ theme, children }: ThemeProviderProps) {
105105

106106
const context =
107107
typeof theme === 'function'
108-
? { ...outer, theme: theme(outer.theme!) }
108+
? { ...outer, theme: theme(outer.theme) }
109109
: merge.all<ContextValue>({}, outer, { theme })
110110

111111
return jsx(BaseProvider, { context }, children)

0 commit comments

Comments
 (0)