8000 Add test case · DINKIN/TypeScript@0806461 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0806461

Browse files
committed
Add test case
1 parent b1fac59 commit 0806461

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
function isA<A>(x: any, y: any): x is A | y is B {
2+
return false;
3+
}
4+
5+
var x: number | number[];
6+
var y: string | string[];
7+
var num: number;
8+
var nums: number[];
9+
var strOrStrs: string | string[];
10+
11+
if (isA<number>(x, y)) {
12+
num = x;
13+
strOrStrs = y;
14+
}
15+
else {
16+
nums = x;
17+
strOrStrs = y;
18+
}

0 commit comments

Comments
 (0)
0