Closed adamdry closed 4 years ago
I like interfaces very much too. But the problem is that typescript interfaces does not provide any runtime information to be used as key for a Container resolution.
Other frameworks, like Inversify, supports interfaces through an additional information (discussed in #20 ), but we choose to not follow this approach.
Resuming, you can use interfaces on your code, but you will not be able to bind it to the Container. For that situations where you need to instantiate them with the Container, you need to replace to abstract classes
In the README.MD there is a section called
A note about classes and interfaces
which as far as I can tell basically says don't use interfaces, instead use abstract classes with abstract properties/functions.I just want to clarify that that is the best practise when using typescript-ioc? I.e. I shouldn't have any interfaces in my app?