Skip to content
webtype.org#230 permutation · par 5

No. 230 · Brutal · conditional types

Permutation

Implement `Permutation<T>` so it turns a union into the union of every tuple ordering of its members. `never` has exactly one permutation: the empty tuple.

Puzzle

permutation.ts
Stroke 1 of 5Not run yet

Replace ??? — your solution is checked against the cases below.

Checks

4
  • Permutation<'a'>
    ['a']
  • Permutation<never>
    []
  • Permutation<'a' | 'b'>
    ['a', 'b'] | ['b', 'a']
  • Permutation<1 | 2>
    [1, 2] | [2, 1]

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

How everyone did

Nobody is counting yet. Score distribution and the short game board arrive with accounts — until then your results stay on this device.

Archive