Say I wanted to encode an array, which could have either length 1 or 2 into typescript. Say I furthermore wanted to limit the first element in the array to be one of a specific number of strings, eg:
type fruit = 'banana' | 'apple' | 'passionfruit' | 'kiwi'
while the second key was flexible.
something like:
declare interface ObjectExample {
fruit: fruit,
other?: string
}
but for an array. How would I go about doing this?