Indexing a tuple's type by number yields a union of its element types. Literal inference determines how precise that union becomes.
Worked example
type ElementOf<T> = T extends readonly (infer U)[] ? U : never;
console.log(((v: ElementOf<[string, number]>) => v)(8));Result
8Implementation notes
A union of tuple elements discards their positions. Use indexed access at a specific index when position determines meaning.
Try it yourself
Remove a const assertion and inspect how far the union widens.
Open the TypeScript example →Editorial date October 21, 2026 · Published December 6, 2026