Skip to content

Commit d22f4fb

Browse files
Added a test.
1 parent 69e0677 commit d22f4fb

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
class A<T> {
2+
constructor(private a: string) { }
3+
}
4+
5+
class B<T> {
6+
}
7+
8+
function acceptA<T>(a: A<T>) { }
9+
function acceptB<T>(b: B<T>) { }
10+
11+
function test<T>(x: A<T> | B<T>) {
12+
if (x instanceof B) {
13+
acceptA(x);
14+
}
15+
16+
if (x instanceof A) {
17+
acceptA(x);
18+
}
19+
20+
if (x instanceof B) {
21+
acceptB(x);
22+
}
23+
24+
if (x instanceof B) {
25+
acceptB(x);
26+
}
27+
}

0 commit comments

Comments
 (0)