-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Truthy/Falsy checks don't actually understand JavaScript === false and === true leads to !isSomething #53170
Comments
wow exists since 2016 in #9508 and now open again I hope this issue explained why I am not using |
Maybe try a different font? 😜 #31105 is open and approved, I don't know what more you want me to do. This isn't a higher-priority work item than other stuff the team is doing. Someone can send a PR when they'd like to. |
@RyanCavanaugh I wish I could, the problem is at scale, reading code on github, reading it in editors we don't control, font isn't even the main issue, syntax highlighters are, but yeah, its not something code authors can control. @Andarist agreed to work on it if its approved by the team, so this is great news and all we needed to fix it |
I mean even if typescript supports |
@fatcerberus sure, its for a codebase that wants to enforce a convention through linters on per org basis |
also @fatcerberus thanks for explaining to me what my problem is in such a nice tone |
Sorry, I didn’t mean that to come off as presumptuous/condescending—that’s why I specifically said “IF that’s your problem” |
Bug Report
When comparing values with
if (isTrue === true)
andif (isTrue)
or if (isTrue=== false) andif (!isTrue)
, TS doesn't understand those are the same thing.This is in particular a problem because a standard naming convention for booleans is
isSomething
and when used with negation you get!isSomething
....!i
is terrible to read with most popular syntax highlighters and fonts and because of this bug, we can't actually NOT use!isSomething
🔎 Search Terms
truth, falsy
🕗 Version & Regression Information
4.9.5 and 5.1.0-dev.20230308
Please keep and fill in the line that best applies:
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
It didn't see the === true or ===false check but works with
!isSomething
🙂 Expected behavior
Supposed to work with === true or == true and same for false, because these are standard js expressions
The text was updated successfully, but these errors were encountered: