by scottlecrab · 7y ago · 0 comments
Using `as const` will report both the 2nd and 3rd lines as type errors. You've been able to do this in TypeScript for a while even before they introduced the `as const` syntax.
const x = [1, 2] as const;
const r = 666 + 1;
const y = x[r];
const z = y + 3;