import { Tuple } from '../../primitive/Tuple'; import { Push } from '../Push'; import { ToIndex } from '../ToIndex'; import { Zip } from '../Zip'; import { ZipToMap } from '../ZipToMap'; type CapitalizeWords = T extends readonly [ infer First extends string, ...infer Rest extends Tuple ] ? CapitalizeWords>> : R; /** * * Convert an array to an enum * * 튜플을 열거형으로 변환 * * @param T - The array to convert / 변환할 튜플 * * @param N - Whether to convert to a readonly enum / 읽기 전용 열거형으로 변환할지 여부 * * @returns The enum / 열거형 * * @example * const OperatingSystem = ['macOS', 'Windows', 'Linux'] as const; * * type cases = [ * Expect, { readonly MacOS: 'macOS'; readonly Windows: 'Windows'; readonly Linux: 'Linux'; }>>, * Expect, { readonly MacOS: 0; readonly Windows: 1; readonly Linux: 2; }>>, * ]; * * @link https://www.utilscript.site/docs/usage-array/to-enum * */ export type ToEnum = N extends true ? Readonly, ToIndex>>> : Readonly, T>>>; export {};