Skip to content
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

Uncalled function in binary expression not silenced by body usage #49155

Closed
andrewbranch opened this issue May 17, 2022 · 0 comments · Fixed by #49157
Closed

Uncalled function in binary expression not silenced by body usage #49155

andrewbranch opened this issue May 17, 2022 · 0 comments · Fixed by #49157
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@andrewbranch
Copy link
Member

Found in #49142:

declare let isActive: boolean;
declare let onChange: () => void;

if (!isActive && onChange) onChange();

Expected: no error because onChange() is used in the conditional body.
Actual: always-truthy error in the if condition.

@andrewbranch andrewbranch self-assigned this May 17, 2022
@andrewbranch andrewbranch added the Bug A bug in TypeScript label May 17, 2022
@andrewbranch andrewbranch added this to the TypeScript 4.7.2 milestone May 17, 2022
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants