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
If you instantiate your own new Immer() instance to keep settings changes local, the immer.produce method doesn't have the same typing information as the top-level produce export.
import{produce,Immer}from"immer";constimmer=newImmer();constobj={a: 1};produce(obj,(o)=>o);immer.produce(obj,(o)=>o);// ^ Parameter 'o' implicitly has an 'any' type.
With produce the types are as expected. But with immer.produce the draft that gets passed to the callback is of type any instead of Draft.
Environment
We only accept bug reports against the latest Immer version.
Immer version:
I filed this report against the latest version of Immer
Occurs with setUseProxies(true)
Occurs with setUseProxies(false) (ES5 only)
The text was updated successfully, but these errors were encountered:
🐛 Bug Report
If you instantiate your own
new Immer()
instance to keep settings changes local, theimmer.produce
method doesn't have the same typing information as the top-levelproduce
export.Link to repro
https://codesandbox.io/s/new-mountain-fq0uw?file=/src/index.ts
With
produce
the types are as expected. But withimmer.produce
the draft that gets passed to the callback is of typeany
instead ofDraft
.Environment
We only accept bug reports against the latest Immer version.
setUseProxies(true)
setUseProxies(false)
(ES5 only)The text was updated successfully, but these errors were encountered: