← All Exercises

Async Iterable Class

advancedtypescript~30min

Background

Async iterables enable clean consumption of streaming data sources in modern TypeScript.

Problem

Create a class that implements async iterable protocol for consuming streaming data with for-await-of.

Input

Streaming data source

Output

Async iterable values

Sample tests

Sample 1

Input: for await (const x of stream)
Expected: streaming values

Your solution

Learning objective

Master async iteration protocols and streaming patterns