import { IsAny } from '../../commonness/IsAny'; import { Tuple } from '../../primitive/Tuple'; import { MatchReadonly } from '../MatchReadonly'; import { Push } from '../Push'; /** * * Filter an array based on a specific type * * 특정 타입을 기준으로 튜플을 필터링하는 타입 * * @param T The original array type / 원본 튜플 * * @param F The type to filter / 필터링할 요소 타입 * * @returns The filtered array type / 필터링된 튜플 * * @example * type cases = [ * Expect, [2]>>, * Expect, [0, 1]>>, * Expect, [0]>>, * Expect, [null, undefined]>>, * Expect, [never, never, never]>>, * Expect, [2]>>, * ]; * * @link https://www.utilscript.site/docs/usage-array/filter * */ export type Filter = T extends readonly [ infer First, ...infer Rest ] ? [First] extends Tuple ? IsAny extends true ? Filter, F, R> : Filter, F, Push> : Filter, F, R> : MatchReadonly;