import { Tuple } from '../../primitive/Tuple'; import { IndexOf } from '../IndexOf'; import { Length } from '../Length'; import { Max } from '../Max'; import { Min } from '../Min'; import { Push } from '../Push'; import { Splice } from '../Splice'; type SortAsc, R extends Tuple = []> = Length extends 0 ? R : SortAsc>, 1>, Push>>; type SortDesc, R extends Tuple = []> = Length extends 0 ? R : SortDesc>, 1>, Push>>; /** * * Type that sorts an array in ascending or descending order * * 배열을 오름차순 또는 내림차순으로 정렬하는 타입 * * @param T The array type to sort / 정렬할 배열 타입 * * @param Desc Whether to sort in descending order (default: false) / 내림차순으로 정렬할지 여부 (기본값: false) * * @example * * type cases = [ * Expect, [1, 2, 3]>>, * Expect, [1, 2, 3]>>, * Expect, [3, 2, 1]>>, * ] * * @link https://www.utilscript.site/docs/usage-array/sort * */ export type Sort, Desc extends boolean = false> = Desc extends true ? SortDesc : SortAsc; export {};