Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 2.35 KB

File metadata and controls

19 lines (14 loc) · 2.35 KB

Permutations of Tuple medium #union #tuple #conditional type #recursion

by null @gaac510

Take the Challenge

Given a generic tuple type T extends unknown[], write a type which produces all permutations of T as a union.

For example:

PermutationsOfTuple<[1, number, unknown]>
// Should return:
// | [1, number, unknown]
// | [1, unknown, number]
// | [number, 1, unknown]
// | [unknown, 1, number]
// | [number, unknown, 1]
// | [unknown, number ,1]

Back Share your Solutions Check out Solutions

Related Challenges

296・Permutation 4260・AllCombinations 8767・Combination