fix: typescript issue
This commit is contained in:
1 parent
b500bc8221
commit
dce4e4e751
2 files changed
+22
-5
No files matched your search
@@ -17,8 +17,9 @@ import { get, writable } from 'svelte/store'
|
||||
import { env } from '$env/dynamic/public'
|
||||
|
||||
const configuredTheme = env.PUBLIC_THEME ?? 'system'
|
||||
export const theme = writable<'system' | 'light' | 'dark'>(configuredTheme)
|
||||
|
||||
export const theme = writable<'system' | 'light' | 'dark'>(
|
||||
configuredTheme as 'system' | 'light' | 'dark'
|
||||
)
|
||||
|
||||
export const toggleTheme = () => {
|
||||
theme.update((theme) => {
|
||||
@@ -43,7 +44,8 @@ export const inDarkTheme = (): boolean => {
|
||||
|
||||
if (typeof localStorage != 'undefined') {
|
||||
const localTheme: 'system' | 'light' | 'dark' =
|
||||
(localStorage.getItem('theme') as 'system' | 'light' | 'dark') || configuredTheme
|
||||
(localStorage.getItem('theme') as 'system' | 'light' | 'dark') ||
|
||||
configuredTheme
|
||||
|
||||
theme.update((theme) => localTheme)
|
||||
|
||||
|
||||
Reference in new issue
Block a user