So I was doing some filtering on a user object called UserPreference. I was amazed that the filter() and find() methods were not working. 

The code:

const savedFilters = this.currentUser.preferences;
const filters = savedFilters.filter((item:any) => item.key === 'filter');

The error I got was:

error TS2339: Property 'filter' does not exist on type 'UserPreference | UserPreference[]'.
 

Solution

This was my solution: tell typescript to get the values AS ARRAY:

const savedFilters = this.currentUser.preferences as Array<any>;
const savedFiltersAsArray = savedFilters.filter((item:any) => item.key === 'filter');