Skip to content

Report error for common no-op statements #5669

Closed
@elisee

Description

@elisee

Assuming the following code:

function doSomething() {
  alert("Did something");
}

doSomething;

Would it be possible for TypeScript to complain about the doSomething; line, notifying the user that the statement is a no-op and maybe even suggesting adding parentheses to call the function? Or do you folks consider that kind of problems to definitely be a linter error, rather than something the compiler should look out for?

I searched the bugtracker but couldn't find any similar requests, my apologies if I missed them. I don't even know how feasible this would be, maybe ECMAScript has intricacies that make it impossible in all but the simplest cases, but I thought it couldn't hurt to suggest it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DeclinedThe issue was declined as something which matches the TypeScript visionOut of ScopeThis idea sits outside of the TypeScript language design constraints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions