TS2493
Past the end of the tuple
Tuple type 'Pair' of length '2' has no element at index '2'.The compiler’s own words. Not translated — this is the string you pasted into a search box.
A tuple knows exactly how long it is, so indexing past the end is a compile-time error rather than an undefined you find out about later.
Reproduction
type Pair = [number, number] type Third = Pair[2]
The build asserts this emits exactly this code.
Why the compiler says this
This is the difference between a tuple and an array, stated as an error. number[] would answer number for any index because it makes no promise about length; [number, number] promises exactly two, and that promise is what lets length be the literal 2 — the fact every counting type on this site is built on. The strictness that stops you here is the same strictness that makes tuples useful at the type level.
Fixes
- 01
type Pair = [number, number] type Second = Pair[1]
Index inside the range. Tuple indices are zero-based, and the last one is always
length - 1. - 02
type Pair = [number, number] type Any = Pair[number]
Or ask for any element with
[number], which gives the union of everything in the tuple and cannot be out of range by construction.
Takeaway
If you are indexing a tuple with a number you computed, you probably want [number] — or a recursive type that walks it one element at a time.

