Replies: 1 comment
-
|
Also curious to know this. Typing output at the topmost level is possible with setup({
types: {
output: {} as ChildOutput
}
}).createMachine({
// ...
})But I am not aware of a way to specify types of "inline" child actors. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The documentation describes how to type the root output of a machine here, but it is also possible to set output on final states of a child state. Take a look at the following example:
Link to playground
The child state has 2 final states,
childSuccessandchildFailure, that set theresultfield in the output tosuccessorfailure. The parent uses guards inonDoneto decide the next state based on theresultfield in the output. Unfortunately the type of the event that the guard receives is alwaysDoneStateEvent<unknown>. Is there a way to configure the type of the child state output so that the event the guard receives is correctly typed? Or is my only option here to cast inside the guard?Beta Was this translation helpful? Give feedback.
All reactions