How can I extend an interface to say it has all the functions of a model
Hello everyone.
So I have a model - InventoryItem, which implements a AGGridModelInterface.
I do this, because I need specific columns and methods in InventoryItem that are used for the formatting AGGridService.
The problem is that, in the AGGridService, I only use the Interface, because it's Model agnostic, and it's screaming at me that, for example, where does not exist.
Using abstract classes instead of interfaces is weird to me. What would be the best option here?
In short: How can I extend an interface to say it has all the functions of a model?
@henrijss This kinda defeats the point of using an interface in the first place.
An interface is meant to declare the functionality (methods) an object has, and you’re meant to code against those only. If you get an interface, but then go, “But this is X” then you’ve just made the interface completely redundant.
Either use the interface for its intended purpose, or actually declare in your interface all of the functionality you need to rely on in calling code.