Restructuring Array Of Objects In Typescript