Generators function* count(limit: int32): Generator { for (let value: int32 = 0; value < limit; value += 1) { yield value; } } Iteration function* count(limit: int32): Generator { for (let value: int32 = 0; value < limit; value += 1) { yield value; } } let total: int32 = 0; for (const value of count(3)) { total += value; } Async Generators async function* stream(): AsyncGenerator { yield 1; } async function sum(): Promise { let total: int32 = 0; for await (const value of stream()) { total += value; } return total; }