Open
Description
π Search Terms
- narrowing
- parenthesis
- union
- if condition
- switch
π Version & Regression Information
Tested in 5.8, probably not a regression.
β― Playground Link
π» Code
type Test = TestA | TestB;
interface TestA {
type: 'a';
name: string;
}
interface TestB {
type: 'b';
value: number;
}
function _tcb1(this: { test: Test }) {
// TS generated by Angular's Type Check block
const _t1 = (((((this).test)).type));
if (_t1 === "a") {
(((((this).test)).name)); // KO
}
}
π Actual behavior
TS doesn't narrow correctly
π Expected behavior
TS should narrow correctly despite the execessive parenthesis.
Additional information about the issue
This is similar to a priori issue with typeof
expressions #60784