export const unique = (items: T[]): T[] => Array.from(new Set(items)); export const uniqueByKey = >( items: T[], key: keyof T, ): T[] => [...new Map(items.map((item) => [item[key], item])).values()];