Skip to content
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

Allow nullable values in Some and Ok #30

Merged
merged 2 commits into from
Jul 23, 2024

Conversation

JonasWanke
Copy link
Contributor

Based on the suggestion from #10 (comment), this PR removes the extends Object bound from Some and Ok so that nullable types are supported as well.

We mainly want to use a Result<Foo?, Error> in our project, and Option<Foo?> then needs to be allowed as well to not break result.ok(). Both changes allow more flexibility in the usage of this package, but developers don't have to work with nullable types if they don't want to.

As described in the linked suggestion, this should be mostly non-breaking. The only difference I could tell is that Result.err(…) was previously inferred to Result<Object, …> and now becomes Result<dynamic, …> and Option.none() was previously inferred to Option<Object> and now Option<dynamic>. Though I'm guessing that their usages usually have better type arguments inferred from their call-site or one isn't interested in the type arguments.

@nlfiedler nlfiedler merged commit 8b7fe6f into nlfiedler:master Jul 23, 2024
1 check passed
@nlfiedler
Copy link
Owner

Thank you, I will test it with my own applications to see if I run into any issues, and then publish a new release.

@nlfiedler
Copy link
Owner

Tagged and released, thank you again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants