D
D
Dorick582019-10-26 15:52:45
JavaScript
Dorick58, 2019-10-26 15:52:45

How to write an interface for such an object in TypeScript?

Hello, tell me how to write an interface for an object of this type:
segmentsTaxonomy:
1: {segmentName: "GenderMale", segmentDescription: "Male client"}
2: {segmentName: "GenderFemale", segmentDescription: "Female client"}
3: { segmentName: "Recency1", segmentDescription: "Customer bought recently"}
4: {segmentName: "Recency2", segmentDescription: "Customer bought recently"}
5: {segmentName: "Recency3", segmentDescription: "Customer bought a long time ago"}
6 : {segmentName: "Recency4", segmentDescription: "Customer bought a long time ago"}
7: {segmentName: "Recency5", segmentDescription: "Customer bought a very, very long time ago"}
8: {segmentName: "Frequency1", segmentDescription: "Cleanet buys often"}
9: {segmentName: "Frequency2", segmentDescription: "Client doesn't buy very often"}
10: {segmentName: "Frequency3", segmentDescription: "Customer buys rarely"}
11: {segmentName: "Frequency4", segmentDescription: "Customer buys very rare"}
I just can't figure it out. Help plz.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stockholm Syndrome, 2019-10-26
@StockholmSyndrome

interface SegmentsTaxonomy {
  [x: number]: {
    segmentName: string; 
    segmentDescription: string;
  };
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question