From 11bce520dd6f09e4e2c6cadcde1bb577d52166f9 Mon Sep 17 00:00:00 2001 From: spacejack Date: Tue, 16 Jul 2019 13:16:22 -0400 Subject: [PATCH] [Mithril] Fix Stream#map signature (#36910) * Fix Stream.map signature * Additional Stream#map test --- types/mithril/stream/index.d.ts | 4 +--- types/mithril/test/test-stream.ts | 7 +++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/types/mithril/stream/index.d.ts b/types/mithril/stream/index.d.ts index f299a3ea11..62684fe448 100644 --- a/types/mithril/stream/index.d.ts +++ b/types/mithril/stream/index.d.ts @@ -5,9 +5,7 @@ declare namespace Stream { /** Sets the value of the stream. */ (value: T): this; /** Creates a dependent stream whose value is set to the result of the callback function. */ - map(f: (current: T) => Stream | T | void): Stream; - /** Creates a dependent stream whose value is set to the result of the callback function. */ - map(f: (current: T) => Stream | U): Stream; + map(f: (current: T) => U): Stream; /** This method is functionally identical to stream. It exists to conform to Fantasy Land's Applicative specification. */ of(val?: T): Stream; /** Apply. */ diff --git a/types/mithril/test/test-stream.ts b/types/mithril/test/test-stream.ts index ff86d62211..85d76252bb 100644 --- a/types/mithril/test/test-stream.ts +++ b/types/mithril/test/test-stream.ts @@ -204,6 +204,13 @@ import { Stream } from 'mithril/stream'; console.assert(doubled() === 4); } +{ + const s = stream("a"); + const t = s.map(() => 1); + const n = t() + 1; + console.assert(n === 2); +} + // scan {