Currentlym when you pass useLocalStorageState a { defaultValue: "abc" }, the returned "getter" is still of type T | undefined instead of just T:
const [myVal, setMyVal] = useLocalStorageState("my-key", { defaultValue: "abc" });
This is annoying, because it means you cannot use useLocalStorageState()/useSessionStorageState() as a drop-in replacement for React's useState() -- you always have to handle the undefined manually.
But logically, it seems the TypeScript typings are just wrong / less precise than they could be, and if defaultValue is set myVal should just be of type T, is that right?
If yes, could the typings be fixed?