Explore Library
Code QuizIntermediate

Equality Narrowing Dead Branch

An else-if compares against a value already excluded by narrowing.

Codetypescript
function handle(x: "a" | "b" | "c") {
  if (x !== "a") {
    console.log("not a");
  } else if (x === "b") {
    console.log("is b");
  }
}

What is the bug in this code?