Skip to content

How to add DoneActorEvent types to guard definitions in setup? #5129

Answered by davidkpiano
cmh-echomark asked this question in Q&A
Discussion options

You must be logged in to vote

I don't recommend trying to infer DoneActorEvent here, since you must assume that, unless the guard is inline, that the guard can be called in any transition.

Instead, use params:

guards: {
  isThisDone: (_, { isDone }) => {
    return isDone;
  }
},

// ...

onDone: {
  guard: {
    type: 'isDone',
    params: ({ event }) => ({
      isDone: event.output.isDone
    })
  }
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@cmh-echomark
Comment options

Answer selected by cmh-echomark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants