-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
Bug Report
π Search Terms
uncalled function checks
, negation
π Version & Regression Information
- This is the behavior in every version I tried
β― Playground Link
Playground link with relevant code
π» Code
declare function isFoo(): boolean;
declare const isUndefinedFoo: (() => boolean) | undefined;
if (isFoo) {
// uncalled function checks already work well here
}
if (!isFoo) {
// uncalled function checks should cover this case too
}
if (!isUndefinedFoo) {
// this case should not be covered
}
π Actual behavior
Uncalled function checks do not work with the !
operator.
π Expected behavior
Unless a function may be undefined it would be very helpful to check whether it is called when it is used with the !
operator.
I created this issue to separate a part of the implementation of #42835 resulting from issue #35584. This specific issue was inspired by #35584 (comment).
gabritto, alexthemark, AlexMarkUSDS and nicholasguyett
Metadata
Metadata
Assignees
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript