Skip to content
webtype.orgwebtype.org

    ↑↓ move · ⏎ open · esc close

    No. 273 · September 25, 2026 · Brutal

    Cartesian product

    Implement Cartesian<A, B> so it produces one tuple for every pairing of a member from union A with a member from union B.

    01

    Puzzle

    Par 5

    Puzzle

    cartesian-product.ts
    Stroke 1 of 5Not run yet

    Replace ??? — your solution is checked against the cases below. Tab indents; press Escape then Tab to move focus out.

    Checks

    3
    • Cartesian<'a' | 'b', 1 | 2>—
      → ['a', 1] | ['a', 2] | ['b', 1] | ['b', 2]
    • Cartesian<'x', true | false>—
      → ['x', true] | ['x', false]
    • Cartesian<never, 1>—
      → never

    How a check is judged Exact type equality, not assignability — an intersection is not the same as the flattened object.

    How everyone did

    Fewer than 5 people have solved this one so far. The distribution appears once there is enough of a sample to mean anything.

    Short game

    Fewest characters

    No public scores yet.

    Archive
    02

    Annotated solution

    This write-up publishes 24 hours after the puzzle closes.

    Uses