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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
add IsNothing()
type guard
#988
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
馃殌 Feature Proposal
Add
IsNothing()
type guard that can excludeNothing
from a union type.Motivation
The following does not work:
Since the
Nothing
type is implemented as a class, thex === nothing
will not remove theNothing
type from the control flow analysis.Adding a
IsNothing()
type guard will solve this problem.Can this be solved in user-land code?
I can implement that easily in user-land, but this is a core concept of
immer
and IMO should live insideimmer
.I can contribute to the project. Just want to know which file should I add the tests to.
The text was updated successfully, but these errors were encountered: