score:1

Accepted answer

Consider the following, simpler example:

interface Moment {
  prop1: string;
}

const z:  Moment[] | number[] = [];
z.includes(1)

// TS2345: Argument of type '1' is not assignable to parameter of type 'Moment & number'.   
// Type '1' is not assignable to type 'Moment'.

// Signature of includes in this case:
Array<T>.includes(     
  searchElement: Moment & number,     
  fromIndex: number | undefined): boolean

Note that if z can be either Moment or number, than, for includes to succeed in either case, searchElement must be an union of Moment & number

Now, let's take a look at your example:

expandedFilters.experience 
// type is string | Moment[] | number[]

Typescript again tries to make union of element types. As string is not an array, it is impossible.

Therefore, it infers type of searchElement to never.


Related Query

More Query from same tag