Type alias Yielding<T>

Yielding<T>: {
    [iterator](): JobIterator<T>;
}

A pausable computation that ultimately produces a value of type T.

An item of this type can be used to either create a job of type T, or awaited in a job via yield * to obtain the value.

Any generator function that ultimately returns a value, implicitly returns a Yielding of that type, but it's best to explicitly declare this so that TypeScript can properly type check your yield expressions. (e.g. function *(): Yielding<number> {} for a generator function that ultimately returns a number.)

Generator functions implementing this type should only ever yield * to things that are of Yielding type, such as a Job, to() or other generators declared Yielding.

Type Parameters

  • T

Type declaration

Yields

Suspend<any>

Returns

T