实现一个通用工具类型 Permutation<T> ,它的作用是将联合类型进行全排列,转换成所有可能的全排列数组的联合类型。
Permutation<T>
例如:
// expected to be ['A', 'B', 'C'] | ['A', 'C', 'B'] | ['B', 'A', 'C'] | ['B', 'C', 'A'] | ['C', 'A', 'B'] | ['C', 'B', 'A'] type perm = Permutation<'A' | 'B' | 'C'>
TypeScript