Open rimo030 opened 5 months ago
type Combination<T extends string[], U = T[number], K = U> = K extends string ? `${K}` | `${K} ${Combination<[], Exclude<U, K>>}` : never
type cases = [ Expect<Equal<Combination<['foo', 'bar', 'baz']>, 'foo' | 'bar' | 'baz' | 'foo bar' | 'foo bar baz' | 'foo baz' | 'foo baz bar' | 'bar foo' | 'bar foo baz' | 'bar baz' | 'bar baz foo' | 'baz foo' | 'baz foo bar' | 'baz bar' | 'baz bar foo'>>, ]