Unnecessary | null
ckknight opened this issue · comments
Summer Knight commented
local-storage/src/use-localstorage.ts
Line 44 in 0252629
I believe useLocalStorage
should have two separate exports:
export function useLocalStorage<TValue = string>(key: string): [TValue | null, (newValue: TValue) => void, () => void];
export function useLocalStorage<TValue = string>(key: string, initialValue: TValue): [TValue, (newValue: TValue) => void, () => void];
Notice the lack of | null
on the second export, as it is guaranteed to be non-null
by the specification of initialValue
.
Joe commented
That is correct. Good catch!