Optional Tuple Elements in TypeScript
Tuples can have optional elements, for which a value may not be specified. To indicate that an element is optional, a question mark is placed after the element type.
For example, in the tuple with the user, we will make one more optional element:
let user: [string, number, boolean?];
Let's fill our tuple by specifying the third element:
user = ['john', 31, true];
Now let's fill the tuple by omitting the third element:
user = ['john', 31];
Fill in the following tuple with data:
let date: [number, number?, number?];