From ce3b639ce9832210908d97a0aeddf7a1ee9f6a68 Mon Sep 17 00:00:00 2001 From: Wesley Dai Date: Sun, 11 Feb 2024 15:30:39 -0600 Subject: [PATCH] fix(theme): fix typing --- src/context/ThemeContext.tsx | 2 ++ src/types/index.d.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/context/ThemeContext.tsx b/src/context/ThemeContext.tsx index cf0f83b..6c08d0f 100644 --- a/src/context/ThemeContext.tsx +++ b/src/context/ThemeContext.tsx @@ -27,6 +27,8 @@ export const ThemeProvider = ({ }, []); useEffect(() => { + // Observe theme change and update React state + // Reactive switching of theme for React components that use the context const targetNode = document.documentElement; const observer = new MutationObserver((x) => { const node = x?.[0].target as HTMLElement; diff --git a/src/types/index.d.ts b/src/types/index.d.ts index bd727eb..afb3d5c 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -1,6 +1,6 @@ export class DarkMode { setDarkMode(darkMode: boolean, doSave = true): void; - inDarkMode(): boolean; + get inDarkMode(): boolean; } declare global {