https://type-level-typescript.com/arrays-and-tuples#mixing-arrays-and-tuples

Mixing Arrays and Tuples

Since the introduction of Variadic Tuples, we can use the ... rest element syntax to mix Arrays and Tuples. This allows us to create types representing arrays with any number of values, but with a few fixed types at specific indices.

// number[] that starts with 0
type PhoneNumber = [0, ...number[]];
 
// string[] that ends with a `!`
type Exclamation = [...string[], "!"];
 
// non-empty list of strings
type NonEmpty = [string, ...string[]];
 
// starts and ends with a zero
type Padded = [0, ...number[], 0];

This is great to capture some of the invariants of our code that we often don’t bother typing properly. For example, a French social security number always starts with a 1 or a 2. We can encode this with this type:

type FrenchSocialSecurityNumber = [1 | 2, ...number[]];

Neat!