Type alias Coroutine<T>

Coroutine<T>: Generator<undefined, T, unknown> | (() => Generator<undefined, T, unknown>)

A Coroutine is either a Generator<undefined, T, unknown> or a Generator function that returns such a Generator. The union is a convenience that makes it possible to pass in Generator function literals where a Generator instance would be expected.

Type Parameters

  • T

    The return type of the generator. Coroutines always yield undefined.

Type declaration

    • (): Generator<undefined, T, unknown>
    • Returns Generator<undefined, T, unknown>