Filling a Tuple in TypeScript
Using the rest operator, you can define a set of elements in a tuple consisting of an arbitrary number of values that have the same type.
As an example, let's make a tuple where the first element must be a string, followed by an arbitrary number of numbers:
let tpl: [string, ...number[]];
Let's fill our tuple with data:
tpl = ['str', 1, 2, 3, 4, 5];
Fill in the following tuple with data:
let tpl: [string, string, ...number[]];
Fill in the following tuple with data:
let tpl: [number, boolean, ...string[]];