When initializing an atom with null or undefined the returned setter has a type of never, which makes typescript unhappy whenever I try to invoke it to update the state.
// Works as expected - setCount: (update?: SetStateAction<number>) => void
const [count, setCount] = atom(0)
// Doesn't work as expected - setCount: never
const [count, setCount] = atom<number | null>(null);
I'd be happy to look into it if needed.
When initializing an atom with
nullorundefinedthe returned setter has a type ofnever, which makes typescript unhappy whenever I try to invoke it to update the state.I'd be happy to look into it if needed.