Filter Array

Medium
array
infer
conditional types
recursion

Description:

Implement the type Filter<T, Predicate> takes an Array T, primitive type or union primitive type Predicate and returns an Array include the elements of Predicate.

For example:

Filter<[0, 1, 2], 2> // Expected: [2]

Code

Loading...