Skip to content

Commit 70f0bac

Browse files
committed
Add BaseProviderProps
1 parent 3b7743c commit 70f0bac

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

packages/core/src/index.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ const parseProps = props => {
3333
export const jsx: typeof React.createElement = (type, props, ...children) =>
3434
emotion.apply(undefined, [type, parseProps(props), ...children])
3535

36-
export const Context = React.createContext<{
36+
export interface ContextValue {
3737
__EMOTION_VERSION__: string
3838
theme: Theme | null
39-
}>({
39+
}
40+
export const Context = React.createContext<ContextValue>({
4041
__EMOTION_VERSION__,
4142
theme: null,
4243
})
@@ -64,7 +65,10 @@ export const merge = (a, b) =>
6465

6566
merge.all = (...args) => deepmerge.all(args, { isMergeableObject, arrayMerge })
6667

67-
const BaseProvider = ({ context, children }) =>
68+
interface BaseProviderProps {
69+
context: ContextValue
70+
}
71+
const BaseProvider: React.FC<BaseProviderProps> = ({ context, children }) =>
6872
jsx(
6973
EmotionContext.Provider,
7074
{ value: context.theme },
@@ -97,8 +101,5 @@ export function ThemeProvider({ theme, children }: ThemeProviderProps) {
97101
? { ...outer, theme: theme(outer.theme) }
98102
: merge.all({}, outer, { theme })
99103

100-
return jsx(BaseProvider, {
101-
context,
102-
children,
103-
})
104+
return jsx(BaseProvider, { context }, children)
104105
}

0 commit comments

Comments
 (0)