1interface EnumServiceGetOrderBy {
2 [index: number]: { id: number; label: string; key: any };
3}
4
5/*
6for
7result =
8 [
9 { id: 0, label: 'CId', key: 'contentId' },
10 { id: 1, label: 'Modified By', key: 'modifiedBy' },
11 { id: 2, label: 'Modified Date', key: 'modified' },
12 { id: 3, label: 'Status', key: 'contentStatusId' },
13 { id: 4, label: 'Status > Type', key: ['contentStatusId', 'contentTypeId'] },
14 { id: 5, label: 'Title', key: 'title' },
15 { id: 6, label: 'Type', key: 'contentTypeId' },
16 { id: 7, label: 'Type > Status', key: ['contentTypeId', 'contentStatusId'] }
17 ];
18*/
19
1//Define an interface to standardize and reuse your object
2interface Product {
3 name: string;
4 price: number;
5 description: string;
6}
7
8let pen: Product = {
9 name: "Pen",
10 price: 1.43,
11 description: "Userful for writing"
12}
13
14let products: Product[] = [];
15products.push(pen);
16//...do other products.push(_) to add more objects...
17console.log(products);
18/* -->
19*[
20* {
21* name: "Pen",
22* price: 1.43,
23* description: "Userful for writing"
24* },
25* ...other objects...
26*]
1interface User {
2 [index: number]: {
3 firstname: string;
4 lastname: string;
5 age: number;
6 }
7}
1interface Animal { name: string; size: "small"; medium; large;}const animalsArray: Animal[] = [ { name: "chicken", size: "small" }, { name: "pig", size: "medium" }, { name: "cow", size: "large" },];