interfaces are usually used to define the necessary methods before implementing a class.
optional properties are properties that are not required in an object
readonly
causes an error if you try to change the value
there is a property value called birthday in the p2 object, but there is no birthday in Person.
but you can type p2 into the Person type
this is because the p3 type is a larger type containing the type of p2
without defining the property name specifically in the interface ,
Defining only the type of a value is called an index type.
i defined the type of the function with interface, input the parameter on the left and the return type on the right
of course, the code above is the same.
it just shows that you can define a function type with an interface as well.
an interface can be implemented as a class.
if the property defined in the interface is not defined, an error occurs.
an interface can use extends to create a new interface.
multiple interfaces can be extended
multiple interfaces can be extended with cross-type