microsoft/vscode-js-profile-visualizer

improve array index checks

marcellourbani opened this issue · 1 comments

By detault typescript doesn't handle array types correctly:

const foo:string[]=[]
const bar:string = foo[0] // type checks, but bar is undefined

If we enable compiler option noUncheckedIndexedAccess, it returns an error:

Type 'string | undefined' is not assignable to type 'string'.
  Type 'undefined' is not assignable to type 'string'.