Type Challenges Judge

Combination

提出詳細

type Combination<T extends string[], All=T[number], Item=All> = Item extends string ? Item | `${Item} ${Combination<[],Exclude<All,Item>>}` : never
提出日時2023-09-18 13:35:09
問題Combination
ユーザーsankantsu
ステータス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'>>, ]