produceWithPatches
doesn't collapse Immutable<Immutable<T>> into Immutable<T>
#881
Closed
3 tasks done
Labels
🐛 Bug Report
I'm using
produceWithPatches
to update my otherwise immutable state with underlying typeT
, which I store as a field in a class. I want my class to be generic.Since
produceWithPatches
gives me back anImmutable<T>
, I also need to make that field of typeImmutable<T>
, so thatI can assign the result to it.
But this means that when I pass that data into
produceWithPatches
, it's of typeImmutable<T>
, which meansproduceWithPatches
gives me back anImmutable<Immutable<T>>
, which can't be assigned back to the original data.Of course, I can cast around this, but ideally casting shouldn't be necessary.
Since this is related to the return type of
produceWithPatches
, it seems related to #850.Apologies if I'm missing something here. Thanks!
Link to repro
https://codesandbox.io/s/immutable-immutable-t-rbmvq
Observed behavior
produceWithPatches
generates anImmutable<Immutable<T>>
when given anImmutable<T>
.Expected behavior
produceWithPatches
generates anImmutable<T>
when given anImmutable<T>
Environment
setUseProxies(true)
setUseProxies(false)
(ES5 only)The text was updated successfully, but these errors were encountered: