method ReadonlyArray.filter
Private
ReadonlyArray.filter<S extends T>(
predicate: (
value: T,
index: number,
array: readonly T[],
) => value is S
,
thisArg?: any,
): S[]

Returns the elements of an array that meet the condition specified in a callback function.

Type Parameters

S extends T

Parameters

predicate: (
value: T,
index: number,
array: readonly T[],
) => value is S

A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

optional
thisArg: any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Return Type

S[]
ReadonlyArray.filter(
predicate: (
value: T,
index: number,
array: readonly T[],
) => unknown
,
thisArg?: any,
): T[]

Returns the elements of an array that meet the condition specified in a callback function.

Parameters

predicate: (
value: T,
index: number,
array: readonly T[],
) => unknown

A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

optional
thisArg: any

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Return Type

T[]