import { IsTuple } from '../../commonness/IsTuple'; import { Tuple } from '../../primitive/Tuple'; import { Includes } from '../Includes'; import { MatchReadonly } from '../MatchReadonly'; import { Push } from '../Push'; /** * * Type that takes an array and a value or array of values and returns a new array with the values removed * * 튜플과 값 또는 튜플을 받아 지정된 값을 제거한 새로운 튜플을 반환하는 타입 * * @params T - Tuple to remove values from / 값을 제거할 튜플 * * @params U - Values to remove / 제거할 값 또는 값 튜플 * * @params R - Resulting array / 결과 튜플 * * @returns Tuple with the values removed / 지정된 값을 제거한 튜플 * * @example * type cases = [ * Expect, [2]>>, * Expect, [4, 5]>>, * Expect, []>>, * Expect, ['c']>>, * Expect, ['abc', 'c']>>, * Expect, [1]>>, * Expect, [1, 2, 3]>>, * ]; * * @link https://www.utilscript.site/docs/usage-array/without * */ export type Without = T extends readonly [ infer TF, ...infer TR ] ? IsTuple extends true ? U extends Tuple ? Includes extends true ? Without, U, R> : Without, U, Push> : never : [TF] extends [U] ? Without, U, R> : Without, U, Push> : MatchReadonly;