Skip to content
This repository was archived by the owner on Oct 16, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/five-pillows-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/fuselage-hooks': patch
---

Preserves the generic type of `useLocalStorage` and `useSessionStorage`'
4 changes: 2 additions & 2 deletions packages/fuselage-hooks/src/useStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const useStorage = <T>(
export const useLocalStorage = useStorage.bind(
null,
typeof window !== 'undefined' ? window.localStorage : undefined,
);
) as <T>(key: string, fallbackValue: T) => [T, Dispatch<SetStateAction<T>>];

/**
* Hook to deal with sessionStorage
Expand All @@ -133,4 +133,4 @@ export const useLocalStorage = useStorage.bind(
export const useSessionStorage = useStorage.bind(
null,
typeof window !== 'undefined' ? window.sessionStorage : undefined,
);
) as <T>(key: string, fallbackValue: T) => [T, Dispatch<SetStateAction<T>>];