Tuple Filter
提出詳細
type FilterOut<T extends any[], F> = T extends [infer L, ...infer R] ? [L] extends [F] ? FilterOut<R, F> : [L, ...FilterOut<R, F>] : []
提出日時 | 2024-09-12 08:04:10 |
---|---|
問題 | Tuple Filter |
ユーザー | ookkoouu |
ステータス | Accepted |
import type { Equal, Expect } from '@type-challenges/utils' type cases = [ Expect<Equal<FilterOut<[], never>, []>>, Expect<Equal<FilterOut<[never], never>, []>>, Expect<Equal<FilterOut<['a', never], never>, ['a']>>, Expect<Equal<FilterOut<[1, never, 'a'], never>, [1, 'a']>>, Expect<Equal<FilterOut<[never, 1, 'a', undefined, false, null], never | null | undefined>, [1, 'a', false]>>, Expect<Equal<FilterOut<[number | null | undefined, never], never | null | undefined>, [number | null | undefined]>>, ]