PokeVideoPlayer v23.9-app.js-020924_
0143ab93_videojs8_1563605 licensed under gpl3-or-later
Views : 56,097
Genre: Education
License: Standard YouTube License
Uploaded At Dec 21, 2023 ^^
warning: returnyoutubedislikes may not be accurate, this is just an estiment ehe :3
Rating : 4.912 (65/2,886 LTDR)
97.80% of the users lieked the video!!
2.20% of the users dislieked the video!!
User score: 96.70- Overwhelmingly Positive
RYD date created : 2024-09-30T16:35:11.836997Z
See in json
Top Comments of this video!! :3
interface declaration merging goes hand in hand with module augmentation. some examples:
- defining custom matchers in jest
- correcting a type in an upstream package
- defining custom jsx elements
- convenient global types for modules - e.x. Express.User, which is the type of req.user in an express app. You can extend this type to add your own properties to req.user. This is similar to the jest example
IMO types are usually better but sometimes your problem can only be solved with an interface, and sometimes you are defining some type that classes shoulr conform to (a proper OOP "interface").
1 |
I used to think types were the be-all and end-all for typescript. But after evaluating some blog articles in favor of interfaces, I now understand why the typescript team decided to put both in the TS ecosystem. They both have good use cases and we can't really say one is definitely better than the other. So, on this one, I'm going to have to disagree.
3 |
To define React props which is better? interfaces or types? I think semantically interface fits better and since it's usually defined in the same file as the component definition there's less chance it will be redefined. For rest of the types in for example a types.ts file I think it's better to go with types.
1 |
@fabien-bouvier
10 months ago
The semantic behind interfaces is to describe an object behavior contract. It's an OOP concept. A class can implement several interfaces. It kinda solves the unique inheritance limitation and allows to write very generic code by expanding Liskov Substitution capabilities in OOP.
This why you should use interfaces. For everything else, use types. The right tool for the right job. Both have their purpose.
13 |