I'm currently working with typescript@2 and the highlandjs library. In the typings for highland, there seems to be a missing function called mergeWithLimit(n)
. This function:
Accepts a Stream of Streams, merges their values and errors into a single new Stream, and limits the number of unpaused streams that can run at any given time.
Unfortunately, this method has not been typehinted yet in the DefinitelyTyped typings. I attempted to add it, but there is only an interface Stream<R>
and none for a stream of streams.
How can I create an interface for a stream of streams? I tried defining an interface:
interface Stream<Stream<R>> implements Stream<R> {
mergeWithLimit(n: number): Stream<R>;
}
However, it does not compile:
365 interface Stream<Stream<R>> implements Stream<R> {
~
index.d.ts(365,28): error TS1005: ',' expected.
365 interface Stream<Stream<R>> implements Stream<R> {
~
index.d.ts(365,31): error TS1109: Expression expected.
365 interface Stream<Stream<R>> implements Stream<R> {
~~~~~~
index.d.ts(365,44): error TS1005: ';' expected.
What is the correct way to typehint mergeWithLimit
?