Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: [Typescript] Child actor send method event argument is an intersection of all child actor events #4913

Open
MichaelSavoia opened this issue May 28, 2024 · 0 comments
Assignees
Labels

Comments

@MichaelSavoia
Copy link

XState version

XState version 5

Description

For a machine that invokes multiple actors, when sending events to child actors via the actor.getSnapshot().children.childActor.send() method, the type for the event argument is an intersection of all invoked actors event types. This prevents the ability to pass events that are unique to the applicable actor.

Screenshot 2024-05-28 at 4 55 25 PM

This only applies to the TS types. The child actor behaves as expected when passed an event that fails the TS type.

Expected result

For a machine invoking multiple child actors, when attempting to send an event to a child actor the event argument should accept any valid event for the applicable child actor.

Actual result

The only allowed events are the events shared across all child actors.

Reproduction

https://stackblitz.com/edit/github-2obepf?file=src%2FfeedbackMachine.ts&view=editor

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants