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
constbaseState={users: [{name: "Richie"}]}constnextState=produce(baseState,draftState=>{original(draftState.users)// is === baseState.users})
Observed behavior
When using the original() function as described in the docs, we get a typescript error:
Argument of type '{ name: string; }[]' is not assignable to parameter of type 'Drafted<{ name: string; }[], ImmerState>'.
Property '[DRAFT_STATE]' is missing in type '{ name: string; }[]' but required in type '{ [DRAFT_STATE]: ImmerState; }'.
Expected behavior
No typescript errors
Workaround
cast to any:
original(draftState.usersasany)// is === baseState.users
馃悰 Bug Report
Link to repro
Stackblitz example
To Reproduce
use the example code from the immer original docs with typescript
Observed behavior
When using the
original()
function as described in the docs, we get a typescript error:Expected behavior
No typescript errors
Workaround
cast to any:
Environments
3.4.5
setUseProxies(true)
setUseProxies(false)
(ES5 only)The text was updated successfully, but these errors were encountered: