diff --git a/mithril.d.ts b/mithril.d.ts index 37179e16..8864d60a 100644 --- a/mithril.d.ts +++ b/mithril.d.ts @@ -238,6 +238,18 @@ declare namespace Mithril { /** A special value that can be returned to stream callbacks to halt execution of downstreams. */ HALT: any; } + + interface StreamScan { + /** Creates a new stream with the results of calling the function on every incoming stream with and accumulator and the incoming value. */ + (fn: (acc: U, value: T) => U, acc: U, stream: Stream): Stream; + } + + interface StreamScanMerge { + /** Takes an array of pairs of streams and scan functions and merges all those streams using the given functions into a single stream. */ + (pairs: [Stream, (acc: U, value: T) => U][], acc: U): Stream; + /** Takes an array of pairs of streams and scan functions and merges all those streams using the given functions into a single stream. */ + (pairs: [Stream, (acc: U, value: any) => U][], acc: U): Stream; + } } declare module 'mithril' { @@ -284,3 +296,13 @@ declare module 'mithril/stream' { const s: Mithril.StreamFactory; export = s; } + +declare module 'mithril/stream/scan' { + const s: Mithril.StreamScan; + export = s; +} + +declare module 'mithril/stream/scanMerge' { + const sm: Mithril.StreamScanMerge; + export = sm; +}