1// There is no int type, use number
2const myInt: number = 17;
3const myDecimal: number = 17.5;
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*]