- filter<T>(fn): (<U>(source: readonly U[]) => Extract<U, T>[])
Parameters
- fn: ((x: unknown) => x is T)
- (x): x is T
Returns x is T
Returns (<U>(source: readonly U[]) => Extract<U, T>[])
- <U>(source): Extract<U, T>[]
Returns Extract<U, T>[]
- filter<V>(fn): (<T>(source: readonly V[]) => T[])
Parameters
- fn: ((x: V) => boolean)
- (x): boolean
Returns boolean
Returns (<T>(source: readonly V[]) => T[])
- <T>(source): T[]
Returns T[]
Filters an array based on a predicate function.
Example