Interfaces are NOT types for objects. Here is the real answer.

Описание к видео Interfaces are NOT types for objects. Here is the real answer.

What if I told you that interfaces are NOT meant to define a type for objects? This is a common misconception in the community since modern frameworks put heavy emphasis on functional programming over OOP. In this video I will show you how to really use interfaces to build powerful applications that are modular and reusable.

The 2 benefits of interfaces as mentioned in the video:
1. Creating a blueprint for classes to let developers know how they should implement those classes.
2. Creating contracts (dependency) between classes. That is also called "dependency injection" which is the fundamental concept of composition design pattern in OOP.

Please note that composition is an advanced concept, and I only touched the surface of it so that I inspire something within you beyond what is common among random internet content.

- Github repo: https://github.com/mmaksi/typescript-...
- Hashnode article: https://markmaksi.hashnode.dev/the-un...

Follow me on X:
  / mmxi47  

#typescript #interfaces #designpatterns #types

Комментарии

Информация по комментариям в разработке