You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Array.filter can change the type of the array when passed a user-defined type guard. See for example this:
// this gets inferred as (number | string)[]
const numberOrStringArray = [1, 2, 'jee']
// this is inferred as number[] thanks to the type guard
const numberArray = numberOrStringArray
.filter((x): x is number => typeof x === 'number')
Could Observable.filter support a similar type guard? The type definition for Array.filter in the example is:
filter<S extends T>(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[];
The text was updated successfully, but these errors were encountered:
Array.filter
can change the type of the array when passed a user-defined type guard. See for example this:Could
Observable.filter
support a similar type guard? The type definition forArray.filter
in the example is:The text was updated successfully, but these errors were encountered: