Closed Ailrun closed 6 years ago
Following code clearly says that from should return Nothing when input is null | undefined. https://github.com/Ailrun/typed-f/blob/ae02c10665cb89a1594cb24b6c8647399115fea0/packages/maybe/src/Maybe.ts#L174-L180
from
Nothing
null | undefined
However, because of order of function type overloading, typescript always gives you Just even if you called it with undefined.
Just
undefined
Description
Following code clearly says that
from
should returnNothing
when input isnull | undefined
. https://github.com/Ailrun/typed-f/blob/ae02c10665cb89a1594cb24b6c8647399115fea0/packages/maybe/src/Maybe.ts#L174-L180However, because of order of function type overloading, typescript always gives you
Just
even if you called it withundefined
.