Add `matchEach` to ts-pattern
Add a new `matchEach` matcher that evaluates all matching clauses and returns all results in order.
ts-pattern-match-each
Normalized profile
What this task asks for
Add a new `matchEach` matcher that evaluates all matching clauses and returns all results in order. `matchEach` must expose the same builder API as `match`, including all `.with()` overloads (single pattern, multi-pattern, and guard variants), `.when()`, `.returnType()`, and `.narrow()`. Unlike `match`, every `.with()` call must accept patterns against the original input type (not the progressively narrowed remainder), since all branches are always evaluated. Exhaustiveness tracking should still narrow the internal type so `.exhaustive()` can verify all cases are handled, while `.narrow()` updates both the internal tracking type and the input type for subsequent calls to exclude handled cases. `.exhaustive()` additionally enforces compile-time exhaustiveness: it should be a type error if not all input cases are handled. `.toExhaustiveFunction()` behaves the same but additionally enforces compile-time exhaustiveness: it should be a type error if not all input cases are handled. Selections via `P.select()` must produce independent results across multiple calls of any compiled function.
Intent
- feature implementation
- configuration tuning
Work surfaces
- compiler
- runtime
- library API
- build system
Technology
- ts-pattern
Expected artifacts
- repository patch
What makes it difficult
- native compilation and dependency integration
- changes span multiple components or interfaces
Published evidence
Model × harness outcomes
Counts are tied to these exact configurations. Harnesses are not treated as equivalent across benchmarks.
- Models
- 13
- Configurations
- 41
- Trials
- 164
Showing 41 of 41 configurations
| Model | Harness | Effort | Result | Passes |
|---|---|---|---|---|
| claude-fable-5vertex_ai | mini-swe-agentpublished configuration | low | All passed | 4/4 |
| claude-fable-5vertex_ai | mini-swe-agentpublished configuration | medium | All passed | 4/4 |
| claude-fable-5vertex_ai | mini-swe-agentpublished configuration | high | Mixed | 2/4 |
| claude-fable-5vertex_ai | mini-swe-agentpublished configuration | xhigh | All passed | 4/4 |
| claude-fable-5vertex_ai | mini-swe-agentpublished configuration | max | All passed | 4/4 |
| claude-opus-4-8anthropic | mini-swe-agentpublished configuration | low | Mixed | 2/4 |
| claude-opus-4-8anthropic | mini-swe-agentpublished configuration | medium | Mixed | 1/4 |
| claude-opus-4-8anthropic | mini-swe-agentpublished configuration | high | Mixed | 2/4 |
| claude-opus-4-8anthropic | mini-swe-agentpublished configuration | xhigh | Mixed | 3/4 |
| claude-opus-4-8anthropic | mini-swe-agentpublished configuration | max | Mixed | 2/4 |
| claude-sonnet-4-6anthropic | mini-swe-agentpublished configuration | high | Mixed | 3/4 |
| claude-sonnet-5anthropic | mini-swe-agentpublished configuration | low | Mixed | 2/4 |
| claude-sonnet-5anthropic | mini-swe-agentpublished configuration | medium | Mixed | 3/4 |
| claude-sonnet-5anthropic | mini-swe-agentpublished configuration | high | Mixed | 3/4 |
| claude-sonnet-5anthropic | mini-swe-agentpublished configuration | xhigh | All passed | 4/4 |
| claude-sonnet-5anthropic | mini-swe-agentpublished configuration | max | All passed | 4/4 |
| gemini-3-1-pro-previewvertex_ai | mini-swe-agentpublished configuration | high | All passed | 4/4 |
| gemini-3-5-flashvertex_ai | mini-swe-agentpublished configuration | medium | All passed | 4/4 |
| glm-5-2zai | mini-swe-agentpublished configuration | high | Mixed | 2/4 |
| glm-5-2zai | mini-swe-agentpublished configuration | max | Mixed | 2/4 |
| gpt-5-4openai | mini-swe-agentpublished configuration | xhigh | Mixed | 2/4 |
| gpt-5-5openai | mini-swe-agentpublished configuration | low | Mixed | 1/4 |
| gpt-5-5openai | mini-swe-agentpublished configuration | medium | All passed | 4/4 |
| gpt-5-5openai | mini-swe-agentpublished configuration | high | All passed | 4/4 |
| gpt-5-5openai | mini-swe-agentpublished configuration | xhigh | Mixed | 3/4 |
| gpt-5-6-lunaopenai | mini-swe-agentpublished configuration | low | No passes | 0/4 |
| gpt-5-6-lunaopenai | mini-swe-agentpublished configuration | medium | Mixed | 2/4 |
| gpt-5-6-lunaopenai | mini-swe-agentpublished configuration | high | Mixed | 3/4 |
| gpt-5-6-lunaopenai | mini-swe-agentpublished configuration | xhigh | Mixed | 3/4 |
| gpt-5-6-lunaopenai | mini-swe-agentpublished configuration | max | Mixed | 3/4 |
| gpt-5-6-solopenai | mini-swe-agentpublished configuration | low | Mixed | 2/4 |
| gpt-5-6-solopenai | mini-swe-agentpublished configuration | medium | Mixed | 3/4 |
| gpt-5-6-solopenai | mini-swe-agentpublished configuration | high | Mixed | 2/4 |
| gpt-5-6-solopenai | mini-swe-agentpublished configuration | xhigh | Mixed | 3/4 |
| gpt-5-6-solopenai | mini-swe-agentpublished configuration | max | Mixed | 3/4 |
| gpt-5-6-terraopenai | mini-swe-agentpublished configuration | low | Mixed | 3/4 |
| gpt-5-6-terraopenai | mini-swe-agentpublished configuration | medium | All passed | 4/4 |
| gpt-5-6-terraopenai | mini-swe-agentpublished configuration | high | All passed | 4/4 |
| gpt-5-6-terraopenai | mini-swe-agentpublished configuration | xhigh | All passed | 4/4 |
| gpt-5-6-terraopenai | mini-swe-agentpublished configuration | max | All passed | 4/4 |
| kimi-k2-7-codeopenrouter | mini-swe-agentpublished configuration | default | Mixed | 1/4 |