Added a test.
This commit is contained in:
parent
69e0677ea1
commit
d22f4fb513
1 changed files with 27 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue