Closed braxtonhall closed 3 months ago
Latest commit: 1f87908f15d387c539281bfc584625a15dbd9f21
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
When writing a match in neverthrow, the
ok
anderr
callbacks must have the sameReturnType
in their signature. This means the following code results in an errorThis can be fixed by annotating the callbacks or the match application with more generic types
However this is pretty inconvenient!
Instead,
match
can infer that the result is the union of whateverok
returns, and whatevererr
returnsUnfortunately, this would be a breaking change! Anyone who had already annotated their method call would now get an error
To support legacy code, we can add a default to the second type argument