UNPKG

522 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 *
7 * ```ts
8 * const machine = createMachine({
9 * // ...
10 * output: {
11 * count: 42
12 * }
13 * });
14 *
15 * const actor = createActor(machine);
16 *
17 * actor.start();
18 *
19 * const output = await toPromise(actor);
20 *
21 * console.log(output);
22 * // logs { count: 42 }
23 * ```
24 */
25export declare function toPromise<T extends AnyActorRef>(actor: T): Promise<OutputFrom<T>>;