UNPKG

519 BTypeScriptView Raw
1import { AnyActorRef, OutputFrom } from "./types.js";
2/**
3 * Returns a promise that resolves to the `output` of the actor when it is done.
4 *
5 * @example
6 * ```ts
7 * const machine = createMachine({
8 * // ...
9 * output: {
10 * count: 42
11 * }
12 * });
13 *
14 * const actor = createActor(machine);
15 *
16 * actor.start();
17 *
18 * const output = await toPromise(actor);
19 *
20 * console.log(output);
21 * // logs { count: 42 }
22 * ```
23 */
24export declare function toPromise<T extends AnyActorRef>(actor: T): Promise<OutputFrom<T>>;