-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refine nothings #14
Comments
This seems to be possible when using function overloads in an example Playground:
|
It appears the existing
|
I don't think that overloading is the path I'd take here. Doesn't the code above mean that we are going to end up returning On a tangential point, but while we are here, why do we have |
I don't really know if this is possible in TypeScript so I'm throwing it here to start discussion.
Background
In flow we tended to use
?Foo
which ends up beingFoo | null | undefined
in TypeScript. Having two values for nothing (e.g.null
andundefined
) is unnecessary and yields a lot of unnecessary checks.In many places we've started to remove
| undefined
in favor of exclusively usingnull
to mean "no value".Desired behavior
Combinators should not add extra types but should preserve the fidelity of the input types.
E.g. the following should compile
Actual Behavior
Re-definitions of
a
andb
won't compile becausemmap
returnsnumber | null | undefined
.The text was updated successfully, but these errors were encountered: