Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update typescript typings for .sample() #536

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ See [combine](#combine) for more details.
#### `sampler.sample(f, ...streams) -> Stream`
#### `most.sample(f, sampler, ...streams) -> Stream`

Create a new stream by combining sampled values from many input streams.
Create a new stream by combining sampled values from one or more input streams.

```
s1: -1-----2-----3->
Expand Down
9 changes: 9 additions & 0 deletions type-definitions/most.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ export interface Stream<A> extends Source<A> {
await<B>(this: Stream<Promise<B>>): Stream<B>;
awaitPromises<B>(this: Stream<Promise<B>>): Stream<B>;

sample<B, R>(
fn: (b: B) => R,
b: Stream<B>,
): Stream<R>;
sample<B, C, R>(
fn: (b: B, c: C) => R,
b: Stream<B>,
Expand Down Expand Up @@ -339,6 +343,11 @@ export function fromPromise<A>(p: Promise<A>): Stream<A>;
export function await<A>(s: Stream<Promise<A>>): Stream<A>;
export function awaitPromises<A>(s: Stream<Promise<A>>): Stream<A>;

export function sample<A, R>(
fn: (a: A) => R,
sampler: Stream<any>,
a: Stream<A>,
): Stream<R>;
export function sample<A, B, R>(
fn: (a: A, b: B) => R,
sampler: Stream<any>,
Expand Down