From a1f722526c469bdbf57a53532496cd43c61a60bb Mon Sep 17 00:00:00 2001 From: Tasso Date: Wed, 17 Sep 2025 23:09:34 -0300 Subject: [PATCH] fix(fuselage-hooks): Preserve generic type of `useLocalStorage` and `useSessionStorage` --- .changeset/five-pillows-agree.md | 5 +++++ packages/fuselage-hooks/src/useStorage.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/five-pillows-agree.md diff --git a/.changeset/five-pillows-agree.md b/.changeset/five-pillows-agree.md new file mode 100644 index 0000000000..2bf525d95c --- /dev/null +++ b/.changeset/five-pillows-agree.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/fuselage-hooks': patch +--- + +Preserves the generic type of `useLocalStorage` and `useSessionStorage`' diff --git a/packages/fuselage-hooks/src/useStorage.ts b/packages/fuselage-hooks/src/useStorage.ts index 9b1c1ce9b7..68e522336b 100644 --- a/packages/fuselage-hooks/src/useStorage.ts +++ b/packages/fuselage-hooks/src/useStorage.ts @@ -121,7 +121,7 @@ export const useStorage = ( export const useLocalStorage = useStorage.bind( null, typeof window !== 'undefined' ? window.localStorage : undefined, -); +) as (key: string, fallbackValue: T) => [T, Dispatch>]; /** * Hook to deal with sessionStorage @@ -133,4 +133,4 @@ export const useLocalStorage = useStorage.bind( export const useSessionStorage = useStorage.bind( null, typeof window !== 'undefined' ? window.sessionStorage : undefined, -); +) as (key: string, fallbackValue: T) => [T, Dispatch>];