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>];