import { If } from '../../commonness/If'; import { IsTuple } from '../../commonness/IsTuple'; import { UnBox } from '../../commonness/UnBox'; import { Tuple } from '../../primitive/Tuple'; /** * * Returns the last element of an array * * 튜플의 마지막 요소를 반환하는 타입 * * @param T Tuple / 튜플 * * @returns Last element of array / 튜플의 마지막 요소 * * @example * type cases = [ * Expect, never>>, * Expect, 2>>, * Expect, 1>>, * Expect 123, { a: string }]>, { a: string }>>, * ]; * * @link https://www.utilscript.site/docs/usage-array/last * */ export type Last = If, T extends readonly [...Tuple, infer L] ? L : never, UnBox>;