Given the following code:
const nums = [1, 2, 3] const filtered = nums.filter(n => n === 4) filtered[100].toString()
Why isn't TypeScript complaining that .toString() wouldn't work because filtered[100] might be undefined?
.toString()
filtered[100]
Playground: https://www.typescriptlang.org/play?#code/MYewdgzgLgBGCuBbCMC8MDaBGANDATHgMwC6AUKJLAGYCWANlAKYBOTAJmnEhAHR2NWACjBoAfHDSp0AFgCUZMgOZt22AAzqSvKCADKUFrTABzIXKA