#is it possible to assert a Done event
1 messages · Page 1 of 1 (latest)
Yes, it's possible. You just need to explicitly define a DoneEvent in your types like so and then you can use in assertEvent.
import { type DoneActorEvent, setup } from 'xstate';
const machine = setup({
types: {
events: {} as {
{ type: 'event' } |
(DoneActorEvent<YourActorOutput> & { type: 'xstate.done.actor.actorID' })
}
}
}).createMachine()
We hope to automatically add done/error/snapshot actor events to the event typings automatically too; just haven't done this yet
Thanks for the reply, I’ll try typing the event as suggested for now, thanks.
This feature would be great! I keep forgetting to add the types to the types setup