You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Interfaces, on TypeScript, exist to perform type checking during compile time. That is, using an interface makes the TypeScript compiler check if variables fill the contract (have the structure) defined by the interface.
As occurs in other programming languages, TypeScript does not require an object to have the exact same structure as defined by the interface. To be considered valid, objects can have any shape as long as they define the functions and properties required by the interface that they implement.
TypeScript Decorators
Decorators offer a declarative syntax to modify the shape of classes and properties declarations. we will be able to develop elegant solutions to cross-cutting concerns like logging and transactions.
Decorators, in the end, are just function wrappers. That is, to create a decorator, we create a function that wraps the call to the original function and changes its behavior in any way we like.