export type EquatablePrimitave =
    | string
    | number 
    | boolean 
    | null 
    | undefined 
    | symbol;

export function removeDuplicates<T>(
    myArray: Array<T>,
    accessor: (element: T) => EquatablePrimitave
): Array<T> {
    return myArray.filter((obj, position, fullArray) => 
        fullArray.map(mapObj => accessor(mapObj))
            .indexOf(accessor(obj)) === position);
}

Original inspiration from:

Removing Duplicate Objects From An Array By Property Name In Javascript - I Like Kill Nerds