Skip to content

Commit 47f6bb2

Browse files
committed
Add test
1 parent fc85bc5 commit 47f6bb2

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// @strictNullChecks: true
2+
3+
// Repro from #10041
4+
5+
(''.match(/ /) || []).map(s => s.toLowerCase());
6+
7+
// Similar cases
8+
9+
function f1() {
10+
let x = ''.match(/ /);
11+
let y = x || [];
12+
let z = y.map(s => s.toLowerCase());
13+
}
14+
15+
function f2() {
16+
let x = ''.match(/ /);
17+
let y = x ? x : [];
18+
let z = y.map(s => s.toLowerCase());
19+
}

0 commit comments

Comments
 (0)