const x = [1,2];
const y = x[666];
const z = y + 3;
Is there a way for TypeScript to flag the last line as a type error?TypeScript will say "y" has type "number" when "x[666]" returns undefined. Why does TypeScript not say the type of "y" is "number | undefined"?