Closed as not planned
Description
π Search Terms
ternary false inference
π Version & Regression Information
Looks like this has been the case forever. (since oldest playground version 3.3333Μ )
β― Playground Link
π» Code
function f(_: string) {};
let x: string | undefined;
const q: boolean = true;
const qc = false as const;
q ? x ? f(x) : null : null;
qc ? x ? f(x) : null : null; // no error as below despite qc being `const false` so it should behave the same?
false ? x ? f(x) : null : null; // error on `x` being string | undefined in impossible branch after x is checked.
π Actual behavior

π Expected behavior
Either disable typechecking in unreachable code or still apply narrowing (as is done in the qc ? ...
line)?
Additional information about the issue
Just sharing since it surprised me a little.