Added a test.

This commit is contained in:
Daniel Rosenwasser 2016-12-30 12:14:31 -05:00
parent 69e0677ea1
commit d22f4fb513

View file

@ -0,0 +1,27 @@
class A<T> {
constructor(private a: string) { }
}
class B<T> {
}
function acceptA<T>(a: A<T>) { }
function acceptB<T>(b: B<T>) { }
function test<T>(x: A<T> | B<T>) {
if (x instanceof B) {
acceptA(x);
}
if (x instanceof A) {
acceptA(x);
}
if (x instanceof B) {
acceptB(x);
}
if (x instanceof B) {
acceptB(x);
}
}