Skip to content

Commit 5a5cc26

Browse files
fix(type-definitions): Constrain this type, add awaitPromises alias (#475)
1 parent f7eb191 commit 5a5cc26

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

type-definitions/most.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ export interface Stream<A> extends Source<A> {
160160
timestamp(): Stream<TimeValue<A>>;
161161
delay(dt: number): Stream<A>;
162162

163-
// Note: Without higher-kinded types, this type cannot be written properly
164-
await<B>(): Stream<B>;
163+
await<B>(this: Stream<Promise<B>>): Stream<B>;
164+
awaitPromises<B>(this: Stream<Promise<B>>): Stream<B>;
165165

166166
sample<B, C, R>(
167167
fn: (b: B, c: C) => R,
@@ -340,6 +340,7 @@ export function delay<A>(dt: number, s: Stream<A>): Stream<A>;
340340

341341
export function fromPromise<A>(p: Promise<A>): Stream<A>;
342342
export function await<A>(s: Stream<Promise<A>>): Stream<A>;
343+
export function awaitPromises<A>(s: Stream<Promise<A>>): Stream<A>;
343344

344345
export function sample<A, B, R>(
345346
fn: (a: A, b: B) => R,

0 commit comments

Comments
 (0)