Allow nullable values in Some
and Ok
#30
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on the suggestion from #10 (comment), this PR removes the
extends Object
bound fromSome
andOk
so that nullable types are supported as well.We mainly want to use a
Result<Foo?, Error>
in our project, andOption<Foo?>
then needs to be allowed as well to not breakresult.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 toResult<Object, …>
and now becomesResult<dynamic, …>
andOption.none()
was previously inferred toOption<Object>
and nowOption<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.