The return type of useImmer() and the ImmerHook types are slightly different. Is there a reason for that difference? In particular, why is the second element of the useImmer() return tuple not typed as Updater? For reference:
(f: (draft: Draft<S>) => void | S) => void // Updater type
(f: ((draft: Draft<S> | S) => void) | S) => void // Second element of the useImmer tuple
The return type of
useImmer()
and theImmerHook
types are slightly different. Is there a reason for that difference? In particular, why is the second element of theuseImmer()
return tuple not typed asUpdater
? For reference: