Skip to content

StreamSource

type StreamSource<T> =
| StreamSourceInstance<T>
| (() => StreamSourceInstance<T>);

Defined in: stream-source.ts:29

A stream source can be an instance OR a factory function that creates one.

Factory functions are useful when you want to defer creation of the stream, or when the same stream needs to be re-created multiple times.

Type Parameter
T
// Instance
const source: StreamSource<number> = [1, 2, 3];
// Factory function
const source: StreamSource<number> = () => generateNumbers();