Closed
Description
With strictNullChecks
: true
, nullable values are not emitted as a result of an array destructure. Any array destructure can potentially emit undefined values.
TypeScript Version: 2.2.1
Code
const x:number[] = []
const [y] = x
y.toString()
Expected behavior:
Compile error on line 3: [ts] Object is possibly 'undefined'
Actual behavior:
Runtime error on line 3: Cannot read property 'toString' of undefined