import { MaybeReadonly } from './MaybeReadonly.js'; import { h as IsArray } from './chunks/DZEfmVOc.js'; import './BooleanAnd.js'; import './BooleanOr.js'; /** * Discard the elements of an array or tuple that match the given type. * * @template T Tuple or array type to discard elements from. * @template U Type of the elements to discard. * @returns The array or tuple without the elements matching the given type. * @example TupleDiscard<[1, "a", 2, "b", 3], number> // ["a", "b"] */ type TupleDiscard, U = unknown> = IsArray extends true ? T extends Array ? Array> : never : T extends MaybeReadonly<[infer Head, ...infer Tail]> ? Head extends U ? [...TupleDiscard] : [Head, ...TupleDiscard] : []; export type { TupleDiscard };