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

fix: do not use typeof when comparing to undefined #1300

Merged
merged 2 commits into from
Jul 22, 2022
Merged

Conversation

alexander-fenster
Copy link
Contributor

Using typeof something === 'undefined' causes bugs (when instead the comparison goes as something === 'undefined', as in several cases in this PR), and these bugs are very hard to find. In modern JS/TS, there is nothing wrong with directly comparing to undefined using ===.

@alexander-fenster alexander-fenster requested a review from sofisl July 22, 2022 17:30
@alexander-fenster alexander-fenster requested a review from a team as a code owner July 22, 2022 17:30
@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Jul 22, 2022
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: s Pull request size is small. labels Jul 22, 2022
@alexander-fenster alexander-fenster added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 22, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 22, 2022
@alexander-fenster alexander-fenster changed the title refactor: do not use typeof when comparing to undefined fix: do not use typeof when comparing to undefined Jul 22, 2022
@alexander-fenster alexander-fenster merged commit b01bf8d into main Jul 22, 2022
@alexander-fenster alexander-fenster deleted the no-typeof branch July 22, 2022 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants