mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
[Mithril] Fix Stream#map signature (#36910)
* Fix Stream.map signature * Additional Stream#map test
This commit is contained in:
parent
c58cffffd8
commit
11bce520dd
4
types/mithril/stream/index.d.ts
vendored
4
types/mithril/stream/index.d.ts
vendored
@ -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> | T | void): Stream<T>;
|
||||
/** Creates a dependent stream whose value is set to the result of the callback function. */
|
||||
map<U>(f: (current: T) => Stream<U> | U): Stream<U>;
|
||||
map<U>(f: (current: T) => U): Stream<U>;
|
||||
/** This method is functionally identical to stream. It exists to conform to Fantasy Land's Applicative specification. */
|
||||
of(val?: T): Stream<T>;
|
||||
/** Apply. */
|
||||
|
||||
@ -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
|
||||
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user