Add type to ThemeContext

This commit is contained in:
Fabian Stamm 2020-04-21 00:54:48 +02:00
parent 81f124378f
commit 2f1221a568
2 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@hibas123/theme-preact", "name": "@hibas123/theme-preact",
"version": "1.0.7", "version": "1.0.8",
"description": "", "description": "",
"main": "out/index.js", "main": "out/index.js",
"dependencies": { "dependencies": {

View File

@ -25,7 +25,9 @@ export interface IThemeContext {
mode: ThemeModes.DARK | ThemeModes.LIGHT; mode: ThemeModes.DARK | ThemeModes.LIGHT;
} }
export const ThemeContext = createContext({}); export const ThemeContext = createContext<IThemeContext>({
mode: ThemeModes.LIGHT,
});
const modeMediaQuery = window.matchMedia("prefers-color-scheme: dark"); const modeMediaQuery = window.matchMedia("prefers-color-scheme: dark");