-
Notifications
You must be signed in to change notification settings - Fork 629
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
feat(assert/unstable): add assertNever
#5690
Conversation
4c191e4
to
1fda8e2
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5690 +/- ##
==========================================
- Coverage 96.25% 96.25% -0.01%
==========================================
Files 476 477 +1
Lines 38501 38513 +12
Branches 5588 5589 +1
==========================================
+ Hits 37060 37070 +10
- Misses 1399 1401 +2
Partials 42 42 ☔ View full report in Codecov by Sentry. |
cabb483
to
d20a6f8
Compare
*/ | ||
|
||
/** | ||
* Make an assertion that `x` is of type `never`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now have a policy of accepting all new features as unstable API. Could you add **UNSTABLE**: New API, yet to be vetted.
note at the beginning of jsdoc and also add @experimental
jsdoc tag? https://github.com/denoland/std/blob/010784cd03d0b3ac7e913d82d3468d293adc13c8/.github/CONTRIBUTING.md#notices-for-unstable-apis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done 👍 c12553a
assertNever
assertNever
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@kt3k |
Got it. I'll watch that issue 👍 |
This is the same as |
@iuioiua I thought that way, but actually |
This commit adds a new function
assertNever
to theassert
submodule.This function is particularly useful when we want to check whether we properly handle all the variants of a discriminated union.
Ref: https://www.typescriptlang.org/docs/handbook/unions-and-intersections.html#union-exhaustiveness-checking