In TypeScript, you can have a non-empty array like this:
type NonEmptyArray<T> = [T, ...T[]];
Via: https://mayhul.com/posts/type-driven-design/