-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Breaking ChangeWould introduce errors in existing codeWould introduce errors in existing codeExperience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
TypeScript Version: v4.1.0-dev.20200822
Search Terms: "did you mean to call"
Code
function foo() { return false }
function is_foo_1() { return foo ? 1 : 0 }
function is_foo_2() { return foo && 1 }
Expected behavior:
The same error (2774) on the access of foo
in both is_foo_1
and is_foo_2
.
Actual behavior:
Only is_foo_1
shows the error. However, from a logical standpoint, I would consider them to be equally incorrect. !foo
doesn't give an error either.
Related Issues:
I found discussions about the implementation of this error, but nothing specific to logical expressions.
Metadata
Metadata
Assignees
Labels
Breaking ChangeWould introduce errors in existing codeWould introduce errors in existing codeExperience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsSuggestionAn idea for TypeScriptAn idea for TypeScript