Type Challenges Judge

Combination

提出詳細

type Combination<T extends string[], U extends string = T[number]> = [U] extends [never] ? never : U | { [K in U]: `${K} ${Combination<Exclude<T[number], K>[]>}` }[U]
提出日時2025-09-23 15:53:08
問題Combination
ユーザーbalckowl
ステータス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'>>, ]