xstateFunctionstoPromisetoPromise CallabletoPromise<T>(actor: T): Promise<OutputFrom<T>>Returns a promise that resolves to the output of the actor when it is done.@exampleconst machine = createMachine({ // ... output: { count: 42 }});const actor = createActor(machine);actor.start();const output = await toPromise(actor);console.log(output);// logs { count: 42 }Type parametersT: AnyActorRefParametersactor: TReturns Promise<OutputFrom<T>>
Returns a promise that resolves to the
output
of the actor when it is done.