Type of elements in the input iterable
Type of elements in the resulting generator
A function that takes an iterable and returns a flattened generator
// Expand each number into an array of that many elements
const expanded = [...flatMap((n: number) => Array(n).fill(n))([1, 2, 3])]
// Result: [1, 2, 2, 3, 3, 3]
Creates a generator that maps each element in an iterable to another iterable, then flattens the results into a single generator. Similar to Array.prototype.flatMap(), but works with any iterable.