monet / monet.js

monet.js - Monadic types library for JavaScript
https://monet.github.io/monet.js/
MIT License
1.6k stars 114 forks source link

Missing type guard argument on fromFalsy #252

Open tvedtorama opened 2 years ago

tvedtorama commented 2 years ago

fromFalsy have this signature:

fromFalsy<V>(val: V|null|undefined): Maybe<V>;

This means that the following produces V=false|string, where it should be V=string:

fromFalsy(false | "some string")

I think the signature should be changed to:

fromFalsy<V>(val: V|null|undefined|false): Maybe<V>;