Closed
Description
TypeScript Version: 2.2.2
Code
const words = new Array<string>();
words.push("foo");
const bar = words[2];
Expected behavior:
When strictNullChecks
is turned on, the type of bar
should be string | undefined
. In the case above, it will definitely be undefined.
Actual behavior:
The type is string
.