Solución
solution.tsTypeScript
function groupBy(items: Record<string, any>[], key: string): Record<string, Record<string, any>[]> {
// Tu codigo aqui
let obj: Record<string, Record<string, any>[]> = {};
for(let item of items){
let newKey: string = item[key];
obj[newKey] ??= [];
obj[newKey].push(item);
}
return obj;
}
// No modificar: necesario para evaluar el resultado.
export { groupBy };0respuestas