Skip to content

Commit 0c5471b

Browse files
committed
Add regression test
1 parent 415c725 commit 0c5471b

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/cases/compiler/narrowingOfDottedNames.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,36 @@ class Foo2
5757
constructor() {
5858
}
5959
}
60+
61+
// Repro from #29513
62+
63+
class AInfo {
64+
a_count: number = 1;
65+
}
66+
67+
class BInfo {
68+
b_count: number = 1;
69+
}
70+
71+
class Base {
72+
id: number = 0;
73+
}
74+
75+
class A2 extends Base {
76+
info!: AInfo;
77+
}
78+
79+
class B2 extends Base {
80+
info!: BInfo;
81+
}
82+
83+
let target: Base = null as any;
84+
85+
while (target) {
86+
if (target instanceof A2) {
87+
target.info.a_count = 3;
88+
}
89+
else if (target instanceof B2) {
90+
const j: BInfo = target.info;
91+
}
92+
}

0 commit comments

Comments
 (0)