Without
提出詳細
type WithoutImpl<T, U> = T extends [infer T1, ...infer T2] ? T1 extends U ? WithoutImpl<T2,U> : [T1, ...WithoutImpl<T2,U>] : [] type Without<T, U> = U extends readonly unknown[] ? WithoutImpl<T,U[number]> : WithoutImpl<T,U>
提出日時 | 2023-09-18 07:36:07 |
---|---|
問題 | Without |
ユーザー | sankantsu |
ステータス | 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]>, []>>, ]