const filterBy = <T extends { options: object }>(collection: T[], options: PartialDeep<T['options']>) => {
return collection.filter((entry) => hasOverlaps(entry.options, options));
};
type FilterOptions<T> = {
[K in keyof T]?: T[K] extends object ? FilterOptions<T[K]> : T[K];
};
type PartialDeep<T> = {
[K in keyof T]?: PartialDeep<T[K]>;
};
const isOverlaps = <T>(entry
^^^