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

Add strict equality operator to TS files src/* #754

Closed

Conversation

prajwalkulkarni
Copy link
Contributor

@prajwalkulkarni prajwalkulkarni commented Jan 21, 2024

💫 Changelog

⭐ Updates TS files src/* to use strict equality operator.
⭐ Only those conditions are updated where it is safe to update == to === and != to !==. (E.g: statements where types of both the operands are known and same, operands that use typeof etc.)
⭐ There still exist several statements where the operator is not updated as the logic might change (== returns true on comparing null and undefined whereas === returns false) or the types of operands are not known (any). Updating this requires manual efforts and it'll be easier once the type safety of the library has been improved.
⭐ The operators still need to be updated in these paths: src/parsers, src/WebGL which will be done on a separate PR (because it'll be difficult to self-review large file changes before submitting PR)

Copy link

codecov bot commented Jan 21, 2024

Codecov Report

Attention: 78 lines in your changes are missing coverage. Please review.

Comparison is base (8c3e9d4) 82.62% compared to head (e5ebc6a) 82.58%.

Files Patch % Lines
src/GLViewer.ts 50.00% 15 Missing and 9 partials ⚠️
src/GLModel.ts 66.66% 13 Missing and 3 partials ⚠️
src/utilities.ts 48.14% 3 Missing and 11 partials ⚠️
src/VolumeData.ts 0.00% 2 Missing and 5 partials ⚠️
src/GLShape.ts 66.66% 4 Missing and 1 partial ⚠️
src/autoload.ts 42.85% 4 Missing ⚠️
src/GLDraw.ts 33.33% 2 Missing ⚠️
src/Gradient.ts 81.81% 2 Missing ⚠️
src/VolumetricRender.ts 0.00% 2 Missing ⚠️
src/Label.ts 83.33% 0 Missing and 1 partial ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #754      +/-   ##
==========================================
- Coverage   82.62%   82.58%   -0.04%     
==========================================
  Files         141      141              
  Lines       11496    11493       -3     
  Branches     2126     2126              
==========================================
- Hits         9498     9492       -6     
+ Misses       1667     1665       -2     
- Partials      331      336       +5     

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

@prajwalkulkarni
Copy link
Contributor Author

@dkoes Could you kindly review and let me know if there are any other changes to be made?

cc @NicolasCARPi

@prajwalkulkarni
Copy link
Contributor Author

prajwalkulkarni commented Jan 24, 2024

UPDATE: Removed typeof wherever a variable/property was compared to "undefined". Added optional chaining wherever a nested property was compared to undefined, e.g.: a.properties[prop] in GLModel.ts where properties is an optional type and could possibly be undefined.

@dkoes dkoes closed this Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants