variadic tuple
A tuple type containing a spread such as [query: string, ...params: (string | number)[]], so its length can vary.
In more detail
The fixed positions set a minimum length and the rest element can sit at the start, middle or end. It is used to type functions that forward or add arguments, such as middleware.
Related terms
- tuple — An ordered, fixed-length group of values in which each position can have its own meaning and type.
- spread syntax — The three-dot JavaScript syntax that copies the items of an array or the properties of an object into a new one.
- rest parameter — A final function parameter written ...args that collects all remaining arguments into an array.
Taught in
- Discriminated Unions: Tagged Variants And Pattern Matching — Production TypeScript
- Tuples: Fixed Length, Labeled Elements And Variadic Tuples — Production TypeScript