From c529eae285b472cc4acdd28848db738a81f5ada3 Mon Sep 17 00:00:00 2001 From: "Devin.Zhu" Date: Wed, 27 Nov 2024 14:46:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20createUseStorageState=203.7.7=20?= =?UTF-8?q?=E4=BB=A5=E4=B8=8A=E7=89=88=E6=9C=AC=E8=BF=94=E5=9B=9E=20undefi?= =?UTF-8?q?ned=20=E7=B1=BB=E5=9E=8B=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hooks/src/createUseStorageState/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/hooks/src/createUseStorageState/index.ts b/packages/hooks/src/createUseStorageState/index.ts index 70a3e2cd9e..591f9b1963 100644 --- a/packages/hooks/src/createUseStorageState/index.ts +++ b/packages/hooks/src/createUseStorageState/index.ts @@ -40,7 +40,7 @@ export function createUseStorageState(getStorage: () => Storage | undefined) { return JSON.stringify(value); }; - const deserializer = (value: string): T => { + const deserializer = (value: string) => { if (options.deserializer) { return options.deserializer(value); } @@ -62,13 +62,13 @@ export function createUseStorageState(getStorage: () => Storage | undefined) { return options.defaultValue; } - const [state, setState] = useState(getStoredValue); + const [state, setState] = useState(getStoredValue); useUpdateEffect(() => { setState(getStoredValue()); }, [key]); - const updateState = (value?: SetState) => { + const updateState = (value: SetState) => { const currentState = isFunction(value) ? value(state) : value; if (!listenStorageChange) {