I noticed that in the following example the type of c is number, not number|undefined:
const a:number[] = []
const c = a[1]
In other words, I can do
let b:number = a[1]
without a problem, while a[1] can be undefined. This may cause hidden bugs in code. Am I missing something?
undefined. It's up to you to check this and avoid errors