Callback interface for controlling async generator execution.
Provides three methods to control the generator's behavior:
const executor = (callbacks: AsyncGeneratorExecutor<number, string>) => { callbacks.yeet(1); callbacks.yeet(2); callbacks.done("completed");}; Copy
const executor = (callbacks: AsyncGeneratorExecutor<number, string>) => { callbacks.yeet(1); callbacks.yeet(2); callbacks.done("completed");};
toAsyncGenerator
The type of yielded values
The type of the return value
The type of thrown values/errors (default: unknown)
unknown
Completes the generator with a return value.
The final return value
Throws an error from the generator.
The error or value to throw
Yields a value from the generator.
The value to yield
Callback interface for controlling async generator execution.
Provides three methods to control the generator's behavior:
Example
See
toAsyncGenerator