ExtractArrayElement

type ExtractArrayElement<TArray extends Array<any>> = TArray extends [
infer TElement,
...infer TRest,
]
? TRest extends []
? TElement
: TArray
: never;