statelyai / xstate

Actor-based state management & orchestration for complex app logic.
https://stately.ai/docs
MIT License
27.23k stars 1.26k forks source link

[@xstate/store] Fix store inspection issues #5037

Closed davidkpiano closed 3 months ago

davidkpiano commented 3 months ago

5027

changeset-bot[bot] commented 3 months ago

⚠️ No Changeset found

Latest commit: ec106a3a203f63230a48e2da0ca105ae492d47df

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

davidkpiano commented 3 months ago

@Andarist I'm not sure why store does not extend ActorRefLike - TypeScript isn't too helpful here

Andarist commented 3 months ago

By passing actorRef to observer.next (and more) you make it possible for the receiver of that reference to call actorRef.send. On the receiver's end, it's possible to call that .send method with EventObject - but the actual actorRef that you have passed there doesn't allow just any EventObject. It only accepts ExtractEventsFromPayloadMap<TEventPayloadMap> and conceptually it's just a subtype of EventObject. That's why it errors.