Type Challenges Judge

Tuple to Union

提出詳細

type TupleToUnion<T extends ReadonlyArray<any>> = T extends [infer F, ...infer Rest] ? F | TupleToUnion<Rest> : never
提出日時2023-04-30 01:37:38
問題Tuple to Union
ユーザーDowanna
ステータスAccepted
テストケース
import type { Equal, Expect } from '@type-challenges/utils' type cases = [ Expect<Equal<TupleToUnion<[123, '456', true]>, 123 | '456' | true>>, Expect<Equal<TupleToUnion<[123]>, 123>>, ]