Skip to content

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

@jrmyio

Description

@jrmyio

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    TypescriptIssue related to Typescript typings

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions