Gets the type of the last element of a readonly tuple T.
If the tuple is empty, it returns never.
For a general (non-tuple) array, it returns the element type. For a tuple
with a rest element (e.g. [1, ...string[]]), the exact last element is
not statically known, so the union of all element types is returned.
Type Parameters
Textendsreadonlyunknown[]
The readonly tuple type.
Returns
The type of the last element, or never if T is empty.
Gets the type of the last element of a readonly tuple
T. If the tuple is empty, it returnsnever. For a general (non-tuple) array, it returns the element type. For a tuple with a rest element (e.g.[1, ...string[]]), the exact last element is not statically known, so the union of all element types is returned.