Apply uncalled function checks to boolean expressions (ts2774) #46051
Labels
Needs Proposal
This issue needs a plan that clarifies the finer details of how it could be implemented.
Suggestion
An idea for TypeScript
Suggestion
Similar to #36048 (implemented in #36402), it would be great if uncalled function checks were applied to expressions like they are for if statements and ternaries.
Playground example
🔍 Search Terms
This condition will always return true since this function is always defined. Did you mean to call it instead? ts2774
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
It would be great if using an uncalled function in a boolean expression was an error.
📃 Motivating Example
It would be great if this was true:
💻 Use Cases
Recently spent awhile debugging some code that was always returning true before realizing I was checking the truthyness of an uncalled function.
The text was updated successfully, but these errors were encountered: