Answer : You can use the following code to group stuff using Typescript. const groupBy = <T, K extends keyof any>(list: T[], getKey: (item: T) => K) => list.reduce((previous, currentItem) => { const group = getKey(currentItem); if (!previous[group]) previous[group] = []; previous[group].push(currentItem); return previous; }, {} as Record<K, T[]>); So, if you have the following structure and array: type Person = { name: string; age: number; }; const people: Person[] = [ { name: "Kevin R", age: 25, }, { name: "Susan S", age: 18, }, { name: "Julia J", age: 18, }, { name: "Sarah C", age: 25, }, ]; You can invoke it like: const results = groupBy(people, i => i.name); Which in this case, will give you an object with string keys, and Person[] values. There are a few key concepts here: 1- You can use function to get the key, this way you can use TS...