Type Challenges Judge

Without

提出詳細

type Switcher<T> = T extends readonly unknown[] ? T[number] : T type Without<T extends unknown[], U> = T extends [infer Head, ...infer Rest] ? Head extends Switcher<U> ? Without<Rest, U> : [Head, ...Without<Rest, U>] : []
提出日時2025-09-16 09:36:58
問題Without
ユーザーbalckowl
ステータスAccepted
テストケース
import type { Equal, Expect } from '@type-challenges/utils' type cases = [ Expect<Equal<Without<[1, 2], 1>, [2]>>, Expect<Equal<Without<[1, 2, 4, 1, 5], [1, 2]>, [4, 5]>>, Expect<Equal<Without<[2, 3, 2, 3, 2, 3, 2, 3], [2, 3]>, []>>, ]