Recursive Pattern
Map Pattern
type SomeMapLoop<List> =
List extends [infer First, ...infer Rest]
? [ /* ... 🤖 your logic */ , ...SomeMapLoop<Rest>]
: [];
Filter Pattern
type SomeFilter<List> =
List extends [infer First, ...infer Rest]
? First extends /* ... ❓ your condition */
? [First, ...SomeFilter<Rest>]
: SomeFilter<Rest>
: [];
Reduce Pattern
type SomeReduce<Tuple, Acc = /* ... 📦 initial value */> =
Tuple extends [infer First, ...infer Rest]
? SomeReduce<Rest, /* ... 🤖 logic */>
: Acc;