SnapshotIn Type unexpectedly changed behavior in MST version 7 (when upgrading from 6)

Author: jrmyioCreated Mar 25, 2025Updated Apr 5, 2025
LabelsTypescript

In MST 6 when you do SnapshotIn<typeof ParentType> it always returned a simple type. Since MST 7 any child / sub type inside ParentType seem to return their SnapshotOrInstance version instead of SnapshotIn of the child type.

I would expect SnapshotIn to always expect a simple JSON rather than allow instances to still be part of the Snapshot type.

Here you can see the MST 6 behavior: https://codesandbox.io/p/sandbox/angry-vaughan-4zcrps

MST 7 behavior: https://codesandbox.io/p/devbox/mst-6-forked-yx22tx

Where I think it makes it a mistake in above sandbox: // UNEXPECTED: // getSomething() is valid here?