Skip to content
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

Further strict null checks #8371

Merged
merged 80 commits into from
Apr 30, 2024
Merged

Further strict null checks #8371

merged 80 commits into from
Apr 30, 2024

Conversation

grahamlangford
Copy link
Collaborator

What does this PR do?

  • Cleans up some more messenger related files
  • Eliminates one of the dependency cycles

Checklist

  • Designate a primary reviewer @BLoe

Copy link

codecov bot commented Apr 29, 2024

Codecov Report

Attention: Patch coverage is 84.61538% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 73.53%. Comparing base (b7aa3a0) to head (5aacdea).
Report is 8 commits behind head on main.

Files Patch % Lines
src/contentScript/pageEditor/insertButton.tsx 0.00% 4 Missing ⚠️
src/contentScript/pageEditor/insertPanel.tsx 0.00% 2 Missing ⚠️
src/utils/inference/markupInference.ts 94.11% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8371      +/-   ##
==========================================
+ Coverage   73.51%   73.53%   +0.01%     
==========================================
  Files        1333     1333              
  Lines       41231    41245      +14     
  Branches     7671     7677       +6     
==========================================
+ Hits        30313    30328      +15     
+ Misses      10918    10917       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulling this out eliminates the cycle but doesn't do much to make the individual files easier to strict null check

Comment on lines +563 to +564
return compact(
selected.map((element) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the logic here was designed to throw the error in the case where a match is not found, rather than return an empty array.

exactMatch.get(0); -- can be asserted due to length check, or code could change to pull this and return if not null

match.get(0); -- also has a length check, could also be rewritten to return if not null otherwise throw the error

Point of this comment is that I don't want to close one source of bugs while opening another, we may as well keep the logic as "tight" as possible compared to previous.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose the compact() call just fixes the type and the logic would remain the same though... 🤔

Oh well, whichever, this works for now I guess, just feels gross to pull in compact() only to fix the typing for us 🤷‍♂️

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, couldn't get the typing to work otherwise. Just another annoying limitation with arrays

Copy link
Contributor

@BLoe BLoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple nit picks, but this looks good otherwise 👍

Copy link

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.

@grahamlangford grahamlangford enabled auto-merge (squash) April 29, 2024 23:56
@grahamlangford grahamlangford merged commit 78fe96d into main Apr 30, 2024
19 checks passed
@grahamlangford grahamlangford deleted the strictNullChecks-insertPanel branch April 30, 2024 00:11
@twschiller twschiller added this to the 1.8.14 milestone Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants