TIL: How to type an array in Typescript to express this array has at least 1 element

By default when typing an array in Typescript I would do the following:

const myArray: T[] = ... // operation that returns an array of type T

However when I'm certain this array has at least one element or when I want to type a function parameter that is an array to express that it must contain at least one element I now do the following:

const myArray: [T, ...T[]] = ... // operation that returns an array of type T

This is especially useful in React where you can hence specify props with more precision.