-
Notifications
You must be signed in to change notification settings - Fork 23
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
More strict null checks work #8340
Conversation
…strictNullChecks-dep-cycle-2
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8340 +/- ##
==========================================
+ Coverage 73.50% 73.52% +0.02%
==========================================
Files 1330 1330
Lines 41131 41142 +11
Branches 7643 7657 +14
==========================================
+ Hits 30233 30250 +17
+ Misses 10898 10892 -6 ☔ View full report in Codecov by Sentry. |
// At least one must match, otherwise userSelectElement would have thrown | ||
activeRoot = | ||
rootElements?.find((rootElement) => rootElement.contains(element)) ?? | ||
null; |
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.
Do you think the comment here means we could safely use assertNotNullish()
?
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.
The problem is find
can always return undefined. I think this is the simplest from a typing. Other option would be to use !
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.
This wouldn't work?
// At least one must match, otherwise userSelectElement would have thrown | |
activeRoot = | |
rootElements?.find((rootElement) => rootElement.contains(element)) ?? | |
null; | |
activeRoot = rootElements?.find((rootElement) => rootElement.contains(element)); | |
// At least one must match, otherwise userSelectElement would have thrown | |
assertNotNullish(activeRoot); |
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.
No, cause then I would have to change the typing of activeRoot
to allow undefined
No loom links were found in the first post. Please add one there if you'd like to it to appear on Slack. Do not edit this comment manually. |
What does this PR do?
Checklist