mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-24 04:30:53 -06:00
Add test
This commit is contained in:
parent
fc85bc5a8a
commit
47f6bb2e26
19
tests/cases/compiler/bestChoiceType.ts
Normal file
19
tests/cases/compiler/bestChoiceType.ts
Normal file
@ -0,0 +1,19 @@
|
||||
// @strictNullChecks: true
|
||||
|
||||
// Repro from #10041
|
||||
|
||||
(''.match(/ /) || []).map(s => s.toLowerCase());
|
||||
|
||||
// Similar cases
|
||||
|
||||
function f1() {
|
||||
let x = ''.match(/ /);
|
||||
let y = x || [];
|
||||
let z = y.map(s => s.toLowerCase());
|
||||
}
|
||||
|
||||
function f2() {
|
||||
let x = ''.match(/ /);
|
||||
let y = x ? x : [];
|
||||
let z = y.map(s => s.toLowerCase());
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user