Combination
提出詳細
type Combination<T extends string[], U = T[number], UU = U> = U extends string ? U | `${U} ${Combination<[], Exclude<UU, U>>}` : never
提出日時 | 2025-01-22 10:46:29 |
---|---|
問題 | Combination |
ユーザー | ookkoouu |
ステータス | Accepted |
import type { Equal, Expect } from '@type-challenges/utils' 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'>>, ]