We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
"TS2873"
Tested in 5.6.0-beta and 5.6.0-dev.20240801
https://www.typescriptlang.org/play/?ts=5.6.0-dev.20240801#code/DYUwLgBAbghsCuIBcEYDsCeEC8E32GAG4AoEgYwHs0BnS0AOmEoHMAKN2BECAH14jw0AExAAzAJZoQwgJQQAZAogBGCAHpocRLKIbNAWgB8gkeKkyK1Oo2bsuiRcrWaHIXfojG8BYCSA
let value: any = null; console.log((value || undefined) && 1 / value); // -> undefined console.log(value && 1 / value); // -> null
"TS2873: This kind of expression is always falsy." is reported for undefined in the first log call.
undefined
No error since undefined is affecting the behavior. Without undefined the expression evaluates to null.
null
No response
The text was updated successfully, but these errors were encountered:
Remove incorrect call to checkTruthinessExpression
1c8d09a
Fixes microsoft#59505
RyanCavanaugh
Successfully merging a pull request may close this issue.
🔎 Search Terms
"TS2873"
🕗 Version & Regression Information
Tested in 5.6.0-beta and 5.6.0-dev.20240801
⏯ Playground Link
https://www.typescriptlang.org/play/?ts=5.6.0-dev.20240801#code/DYUwLgBAbghsCuIBcEYDsCeEC8E32GAG4AoEgYwHs0BnS0AOmEoHMAKN2BECAH14jw0AExAAzAJZoQwgJQQAZAogBGCAHpocRLKIbNAWgB8gkeKkyK1Oo2bsuiRcrWaHIXfojG8BYCSA
💻 Code
🙁 Actual behavior
"TS2873: This kind of expression is always falsy." is reported for
undefined
in the first log call.🙂 Expected behavior
No error since
undefined
is affecting the behavior. Withoutundefined
the expression evaluates tonull
.Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: