Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion type-definitions/most.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
declare type SeedValue<S, V> = { seed: S, value: V };
declare type UnfoldValue<S, V> = SeedValue<S,V> | { done: boolean }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the docs are kind of loose, we may need to be even more permissive. Maybe we can go with this, and then relax it if it causes someone some pain.

Seems like we should tighten the done case to { done: true } since it'd be pointless to return { done: false }. What do you think?

declare type TimeValue<V> = { time: number, value: V };

declare interface Generator<A, B, C> {}
Expand Down Expand Up @@ -228,7 +229,7 @@ export function periodic<A>(period: number, a?: A): Stream<A>;
export function fromEvent<T extends Event>(event: string, target: any, useCapture?: boolean): Stream<T>;
export function fromEvent<T>(event: string, target: any): Stream<T>;

export function unfold<A, B, S>(f: (seed: S) => SeedValue<S, B|Promise<B>>, seed: S): Stream<B>;
export function unfold<A, S>(f: (seed: S) => UnfoldValue<S, A> | Promise<UnfoldValue<S, A>>, seed: S): Stream<A>;
export function iterate<A>(f: (a: A) => A|Promise<A>, a: A): Stream<A>;
export function generate<A>(g: CreateGenerator<A>, ...args: Array<any>): Stream<A>;

Expand Down