Intended outcome:
toJS make set to array
Actual outcome:
expect set obj
How to reproduce the issue:
let mobx = require("mobx");
let a = mobx.observable(new Set());
console.log(mobx.toJS(a)); // [] expect Set {}
Versions
Mobx:4.15.7
Just to note here if turns out to be a bug (I am not sure), you will need to upgrade to MobX 6, we no longer support previous versions.
Actually, it's working correctly in V6, so if need this, you have to upgrade ;)
https://codesandbox.io/s/heuristic-fire-z2szs?file=/src/index.js
Note that in v4 / v5 it is possible to set exportMapsAsObjects option, that achieves the same (despite the name also works for sets). https://github.com/mobxjs/mobx/blob/mobx4and5/docs/refguide/tojson.md
Most helpful comment
Actually, it's working correctly in V6, so if need this, you have to upgrade ;)
https://codesandbox.io/s/heuristic-fire-z2szs?file=/src/index.js