Closed
Description
What happened
Using Immutable 4.0.0-rc.9
, a Map
containing a plain object with a length: <number>
property gets converted via toJS()
to an object containing only an array of that length, with any other properties removed.
What I expected to see was a plain object containing a plain object with all properties intact.
We ran into this issue dealing with the output produced by Draft's convertToRaw
helper which produces a property called inlineStyleRanges
which is an array of objects, all of which have a length: <number>
property.
How to reproduce
You can see it in action here:
https://codepen.io/jsibelman/pen/ooYJMX?editors=0012
The code:
const node = Immutable.Map({
inlineStyleRanges: {
length: 4,
foo: 'bar'
}
});
console.log('node.toJS()', node.toJS());
The output seen in the console:
"node.toJS()" Object {
inlineStyleRanges: [undefined, undefined, undefined, undefined]
}
Metadata
Metadata
Assignees
Labels
No labels