Skip to content

Uncalled Function Checks don't check negative condition #34815

Open
@DanielRosenwasser

Description

@DanielRosenwasser
function foo() {
}

if (!foo) {
    let x = 10
}
else {
}

Expected: Error on !foo that the condition is always true because foo is defined.
Actual: No error.

Also, any work on this should include the following test:

function foo() {

}

if (!foo) {
}
else {
    foo()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions