Skip to content
Advertisement

Typescript : How to group an object of named list of objects by field name

I have to manipulate data in this wonderful language which is javascript. Until there I managed to achieve what I needed on my own but I reached my limits there.

It’s quite hard to explain how my data is structured so let’s make a schema. This is what I have :

JavaScript

What I try to achieve is for each object, grouping the object in the list by type. This would look like this :

JavaScript

Do you have any idea how to achieve that ?

Advertisement

Answer

I think you’re looking for the following (seeing as you have TypeScript in the title of your question):

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement