From a39a1e87c6a1c1f1c33945c7e4b608af8c4c650e Mon Sep 17 00:00:00 2001 From: vlinder Date: Wed, 22 Apr 2020 09:41:04 +0200 Subject: [PATCH 1/2] Add TS typings for sample with one value stream. --- type-definitions/most.d.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/type-definitions/most.d.ts b/type-definitions/most.d.ts index a8db93a8..316029b0 100644 --- a/type-definitions/most.d.ts +++ b/type-definitions/most.d.ts @@ -160,6 +160,10 @@ export interface Stream extends Source { await(this: Stream>): Stream; awaitPromises(this: Stream>): Stream; + sample( + fn: (b: B) => R, + b: Stream, + ): Stream; sample( fn: (b: B, c: C) => R, b: Stream, @@ -339,6 +343,11 @@ export function fromPromise(p: Promise): Stream; export function await(s: Stream>): Stream; export function awaitPromises(s: Stream>): Stream; +export function sample( + fn: (a: A) => R, + sampler: Stream, + a: Stream, +): Stream; export function sample( fn: (a: A, b: B) => R, sampler: Stream, From 1c4dd9f707e2bf5edfef2d854c55a3d33433fadb Mon Sep 17 00:00:00 2001 From: vlinder Date: Wed, 22 Apr 2020 09:48:10 +0200 Subject: [PATCH 2/2] Update .sample docs Updating docs to be more clear about .sample accepting one streams as values argument as well. --- docs/api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api.md b/docs/api.md index 24f61d53..a7f8a633 100644 --- a/docs/api.md +++ b/docs/api.md @@ -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->