You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by no-stack-dub-sack November 18, 2021
When using immer, the setState function accepts a set state callback as the first argument. The current types do not support this:
Though I'm not sure the best way to do this because the overload will still be available when not using Immer and using it would cause a runtime error. Perhaps there's a better way to do this other than just adding an overload that's always present. Maybe something like this:
Discussed in #57264
Originally posted by no-stack-dub-sack November 18, 2021
When using immer, the
setState
function accepts a set state callback as the first argument. The current types do not support this:I propose adding an overload to
setState
so that this code will compile when using the Immer plugin.The new overload could look like this:
Though I'm not sure the best way to do this because the overload will still be available when not using Immer and using it would cause a runtime error. Perhaps there's a better way to do this other than just adding an overload that's always present. Maybe something like this:
Thoughts?
The text was updated successfully, but these errors were encountered: