Interfaces are contracts that our code adheres too. It's an agreement that data structures must follow. This helps every data/logic implementing an interface stay safe from improper or non-matching types. It also validates the types and availability of values passed in.
In TypeScript, interfaces are used for the following:
- Setting up contracts for classes to adhere to.
We will discuss how interfaces are applied in the scenarios we just listed.