Replies: 1 comment
-
Good idea! I've pulled this into an issue in #515. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello. The current representation of the MatchResult relies on the user properly checking for the failed()/succeeded() before accessing the message/shortMessage properties.
With the current typescript we could achieve a substantial improvement at almost no cost. Idea is to move the failure-related properties to the FailedMatchResult that extends the regular MatchResult, remove the nullability marker, and change the result type of the failed() method to the type guard:
This change is backwards-compatible for the code that did perform the failed() check:
The code broken by this change would be easy to fix by adding the corresponding guard.
Beta Was this translation helpful? Give feedback.
All reactions