Type Challenges Judge

Zip

提出詳細

type Zip<T extends readonly unknown[], U extends readonly unknown[]> = T extends [infer T1, ...infer T2] ? U extends [infer U1, ...infer U2] ? [[T1,U1], ...Zip<T2,U2>] : [] : []
提出日時2023-09-18 03:27:26
問題Zip
ユーザーsankantsu
ステータスAccepted
テストケース
import type { Equal, Expect } from '@type-challenges/utils' type cases = [ Expect<Equal<Zip<[], []>, []>>, Expect<Equal<Zip<[1, 2], [true, false]>, [[1, true], [2, false]]>>, Expect<Equal<Zip<[1, 2, 3], ['1', '2']>, [[1, '1'], [2, '2']]>>, Expect<Equal<Zip<[], [1, 2, 3]>, []>>, Expect<Equal<Zip<[[1, 2]], [3]>, [[[1, 2], 3]]>>, ]