Skip to content

Only first unreachable statement flagged in 'case' #55562

@ikonst

Description

@ikonst

🔎 Search Terms

In case, only the first unreachable statement is flagged. This is inconsistent e.g. with function scope.

🕗 Version & Regression Information

Reproduces on 5.2.2 and nightly.

⏯ Playground Link

See Playground

💻 Code

function g() {
  switch ("a") {
    case "a":
      return;
      console.log("a"); // grayed out
      console.log("a"); // not grayed out
  }
}

🙁 Actual behavior

First statement grayed out.

🙂 Expected behavior

Both statements grayed out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: check: Control FlowThe issue relates to control flow analysis

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions