Skip to content

Dead Code (ARCH3188)

Key typescript.quality.dead-code · Severity info · Category quality

Code following a return, throw, break, or continue statement never executes. Unreachable code misleads the reader and adds maintenance burden; it should be removed.

function getRole(user: User): string {
return user.isAdmin ? "admin" : "user";
console.log("done"); // unreachable
}
function getRole(user: User): string {
console.log("done");
return user.isAdmin ? "admin" : "user";
}

Remove unreachable statements or fix the control flow so they actually run.