Consider an array type like the following:
let example1: MyArray = ['John'],
example2: MyArray = [4, 5, 1, 5, 'Eric'],
example3: MyArray = [1, 5, 7, 3, 4, 5, 1, 'Joe'],
...
So one string in the end and an arbitrary count of numbers.
So far I can imagine a naive implementation of the MyArray type (which looks like the Death by a Thousand Overloads problem):
type MyArray = [string]
| [number, string]
| [number, number, string]
| [number, number, number, string]
| [number, number, number, number, string]
...
This is obviously suboptimal. Do better approaches exist?