Additional type exports
paulmelnikow opened this issue · 4 comments
paulmelnikow commented
Hi there, and thanks for this great library! Have just upgraded from v6 to v15 and it seems to be working well.
Since createLocalStorageStateHook()
has been removed and I was using it in one place, I replaced it with my own function, which I needed to annotate with my own types. I ended up checking this in:
export type UpdateState<T> = (newValue: T | ((value: T) => T)) => void
export type LocalStorageState<T> = [T, UpdateState<T>, LocalStorageProperties]
export interface LocalStorageProperties {
isPersistent: boolean
removeItem: () => void
}
Would you consider using / exporting these types from the package? I'd be happy to open a PR.
astoilkov commented
Great idea. Thanks! I will do it, no need for a PR. I will write you when I'm done.
astoilkov commented
Done. You can see the implementation and share your thoughts.
paulmelnikow commented
Wow, that looks great! And thanks so much! I look forward to giving it a try.
astoilkov commented
Great! I will make a new v16 release soon.