TheDocumentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
... token in TypeScript represents two distinct operations depending on its syntactic context: Spread syntax, which expands an iterable or object into discrete elements, and Rest syntax, which collects multiple discrete elements into a single array or object. TypeScript enforces strict type-checking on both operations, inferring resulting types based on the source structures and the presence of literal or contextual type assertions.
Spread Syntax (Expansion)
In value space, spread syntax unpacks elements from an existing structure into a new structure. Array and Tuple Spread When spreading arrays or tuples into a standard array literal, TypeScript infers a general array type (T[]) composed of a widened union of all element types. It does not automatically preserve fixed lengths or positional types. To preserve exact lengths, positional types, and literal types (creating a concatenated tuple type), an as const assertion or a contextual tuple type must be applied.
readonly modifiers when spreading objects into new literals.
Rest Syntax (Collection)
Rest syntax performs the inverse operation, condensing remaining elements or properties into a single binding. It must always be the final element in a destructuring assignment or function signature. Function Rest Parameters In function signatures, a rest parameter collects trailing arguments into an array. TypeScript requires rest parameters to be typed as an array (T[]) or a tuple type.
Type Space Mechanics
TypeScript also allows the... operator directly within type annotations to manipulate tuple types. This is known as Variadic Tuple Types. It allows types to be dynamically constructed by spreading other tuple types or generic type parameters.
Master TypeScript with Deep Grasping Methodology!Learn More





