-
Notifications
You must be signed in to change notification settings - Fork 641
Open
Labels
TypescriptIssue related to Typescript typingsIssue related to Typescript typingsbugConfirmed bugConfirmed bug
Description
Bug report
- I've checked documentation and searched for existing issues and discussions
- I've made sure my project is based on the latest MST version
- Fork this code sandbox or another minimal reproduction.
Sandbox link or minimal reproduction code
https://codesandbox.io/p/devbox/nameless-shadow-987q7v?workspaceId=ws_V6MwkdyBVdYpA4KMGgF9f5
import { types } from "mobx-state-tree";
const Tweet = types
.model("Tweet", {
body: types.string,
read: false, // automatically inferred as type "boolean" with default "false"
})
.actions((tweet) => ({
toggle() {
tweet.read = !tweet.read;
},
}));
const TwitterStore = types.model("TwitterStore", {
tweets: types.map(Tweet),
});
// create an instance from a snapshot
const twitterStore = TwitterStore.create();
twitterStore.tweets.observe((c) => {}); // 🐞 twitterStore.tweets.observe is not a function
Describe the expected behavior
It will not crash.
Describe the observed behavior
It crashes with twitterStore.tweets.observe is not a function
.
Thoughts
I assume the cause is that the ObservableMap
no longer have the observe
method.
PS: Maybe MSTMap should also implement IMSTMap?
Metadata
Metadata
Assignees
Labels
TypescriptIssue related to Typescript typingsIssue related to Typescript typingsbugConfirmed bugConfirmed bug