mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-25 12:40:05 -05:00
Add regression test
This commit is contained in:
15
tests/cases/compiler/strictNullLogicalAndOr.ts
Normal file
15
tests/cases/compiler/strictNullLogicalAndOr.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
// @strictNullChecks: true
|
||||
|
||||
// Repro from #9113
|
||||
|
||||
let sinOrCos = Math.random() < .5;
|
||||
let choice = sinOrCos && Math.sin || Math.cos;
|
||||
|
||||
choice(Math.PI);
|
||||
|
||||
function sq(n?: number): number {
|
||||
const r = n !== undefined && n*n || 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
sq(3);
|
||||
Reference in New Issue
Block a user