@rimbu/stream
Version:
Efficient structure representing a sequence of elements, with powerful operations for TypeScript
17 lines (16 loc) • 895 B
text/typescript
import type { MaybePromise } from '@rimbu/common';
import type { StreamSource } from '@rimbu/stream';
import type { AsyncStream, AsyncStreamable } from '@rimbu/stream/async';
/**
* Any source that can be converted to an `AsyncStream`.
* This includes async streams, sync streams, async iterables, and lazy factories.
* @typeparam T - the element type
*/
export type AsyncStreamSource<T> = undefined | AsyncStreamSource.NonEmpty<T> | AsyncStream<T> | (() => MaybePromise<AsyncStreamSource<T>>) | AsyncStreamable<T> | StreamSource<T> | AsyncIterable<T>;
export declare namespace AsyncStreamSource {
/**
* Any async stream source that is known to contain at least one element.
* @typeparam T - the element type
*/
type NonEmpty<T> = AsyncStream.NonEmpty<T> | AsyncStreamable.NonEmpty<T> | StreamSource.NonEmpty<T> | (() => MaybePromise<AsyncStreamSource.NonEmpty<T>>);
}