Without
提出詳細
type Without<T extends unknown[], U, A extends unknown[] = [], V = U extends unknown[] ? U[number] : U> = T extends [infer E, ...infer R] ? E extends V ? Without<R, U, A> : Without<R, U, [...A, E]> : A
提出日時 | 2023-09-02 09:24:20 |
---|---|
問題 | Without |
ユーザー | ookkoouu |
ステータス | 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]>, []>>, ]