xstate
Version:
Finite State Machines and Statecharts for the Modern Web.
25 lines (24 loc) • 519 B
TypeScript
import { AnyActorRef, OutputFrom } from "./types.js";
/**
* Returns a promise that resolves to the `output` of the actor when it is done.
*
* @example
* ```ts
* const machine = createMachine({
* // ...
* output: {
* count: 42
* }
* });
*
* const actor = createActor(machine);
*
* actor.start();
*
* const output = await toPromise(actor);
*
* console.log(output);
* // logs { count: 42 }
* ```
*/
export declare function toPromise<T extends AnyActorRef>(actor: T): Promise<OutputFrom<T>>;