Interface

Interface are basically a way to describe data shapes such object.
It si also used to define the structure og object. interfaces are better when we need to define a new object pr method of an object.
It is a form of syntax.
It is ddenoted with 'interface' keyowrd for declaration.
Mupltiple merged declaration can be used.
It support the use of object.
                // Aliase and interface allows types to be easily shared between different variables/objects.
                  
                  //Example 1=================================
                  interface Products {
                    name: string;
                    brand: string;
                    quantity: number;
                    price: number;
                  }

                  const products: Products = {
                    name: 'Laptop',
                    brand: 'Dell',
                    quantity: 12,
                    price: 14000,
                  };

                  const calculateProductPrice = (product: Products): number => {
                    const { quantity, price } = product;
                    return quantity * price;
                  };

                  console.log(calculateProductPrice(products));
                  //Example2=================================
                  interface Rectangle {
                    height: number;
                    width: number;
                  }

                  const rectangle: Rectangle = {
                    height: 20,
                    width: 10,
                  };

                  interface ColoredRectangle extends Rectangle {
                    color: string;
                  }

                  const coloredRectangle: ColoredRectangle = {
                    height: 20,
                    width: 10,
                    color: 'red',
                  };
                  
                
//* ************************* //* Type VS Interface //?1 =============================== //* Use custom types when you need unions, intersection, or mapped types //* Use interfaces when defning object shapes or classes that //?2 ================================ //* Interfaces can extends other interfcas to inherit their properties. //* Custom types can use unios and interfcas for more complex type compositionss //* *************************