TypeScript Version: 3.8.2, nightly
Search Terms:
Function truthiness, function truthy check
Code
const someBool = true;
function f() {}
if (f) {}
if (someBool && f) {}
if (!someBool || f) {}
Expected behavior:
All three if statements should throw a This condition will always return true since the function is always defined. Did you mean to call it instead? error.
Actual behavior:
Only the first statement throws the error.
Playground Link: https://www.typescriptlang.org/play/index.html?ts=Nightly#code/MYewdgzgLgBBIFsCmAhEIA2MC8MoCcBXJAbgFgAoSgM0LGCgEtwZqAKAShgG8BfSyo2ow21LnwEUhI+MjSYYAMkWtx-KlOFsAhLNTosAH0OqevIA
Related Issues:
#37149