TypeScript Syntax and Type Operators

Variadic tuple types — generic tuple spreading

A generic tuple spread inserts the elements of a type parameter into another tuple type. This allows a generic function to retain positional relationships when combining or forwarding arguments. A fixed tuple input preserves its known positions, while an unbounded array input can introduce variable-length regions. It is type-level syntax; a runtime spread is still necessary to create a combined array. Example output: "ready true". Tested in the strict TypeScript 5.8.3 / ES2022 baseline; the example is not a runtime type validator.

Formal Syntax & Structure

typescript syntaxtypescript
type WithId<T extends unknown[]> = [number, ...T];

Parameters & Attributes

NameTypeDescription
Tunknown[]Tuple or array type whose elements are spread into the result.

Working Example

Example Snippettypescript
type WithId<T extends unknown[]> = [number, ...T];const entry: WithId<[string, boolean]> = [7, "ready", true];console.log(entry[1], entry[2]);
TypeScript Reference