Interfaces
Here we have an example of a simple interface that defines the shape of a user object:
interface UserInterFace { email: string, token: string, resetPassword: ()=> boolean }
In the preceding code, we have defined an interface that we can implement on any object that should follow rules defined in our interface. The advantage this gives us over other web languages such as vanilla JavaScript is that all objects that implement this interface have to follow the structure defined by the interface. This means that our objects are now strongly typed and have language support such as syntax highlighting, autocompletion, and the throwing of exceptions when implemented incorrectly. If you are a developer working on a large application, this is very important as you have defined the rules and can now be sure that all the objects that implement UserInterFace
will have the same properties as those...