Ensuring Non-Empty Array with `Schema.filter` in TypeScript

is this filter idiomatic ? Schema.NonEmptyArray evaluates to type readonly [number, ...number[]], which does not fit my case
i just want to ensure nibbles.length > 0

const NibblesSchema = Schema.Array(NibbleSchema).pipe(
  Schema.filter((arr) => arr.length > 0 || "nibbles must be non-empty")
);
Was this page helpful?