Type Challenges Judge

Join

提出詳細

type Join<T extends string[], U extends string | number> = T extends [infer T1 extends string, ...infer T2 extends string[]] ? T2 extends [] ? T1 : `${T1}${U}${Join<T2,U>}` : ""
提出日時2023-09-18 07:52:22
問題Join
ユーザーsankantsu
ステータスAccepted
テストケース
import type { Equal, Expect } from '@type-challenges/utils' type cases = [ Expect<Equal<Join<['a', 'p', 'p', 'l', 'e'], '-'>, 'a-p-p-l-e'>>, Expect<Equal<Join<['Hello', 'World'], ' '>, 'Hello World'>>, Expect<Equal<Join<['2', '2', '2'], 1>, '21212'>>, Expect<Equal<Join<['o'], 'u'>, 'o'>>, ]