Type guard not considered for unreachable code
Open
feature request
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
```
function typeGuardNotDetectingUnreachableCode(x: string | boolean) {
if (typeof x === "string" && x === false) {
console.log();
}
}
function unreachableCodeDetectedFine1() {
return;
console.log();
}
function unreachableCodeDetectedFine2() {
throw new Error();
console.log();
}
```
It would be good if the first scenario was highlighted as unreachable code, like the other 2 scenarios are. TypeScript currently detects this scenario.
Contributor guide
Assessment
This issue has not been assessed yet.