Should all injectable types require an interface? #12252
Labels
C:depinject
Issues and PR related to depinject
S:proposed
T: Dev UX
UX for SDK developers (i.e. how to call our code)
Currently in
depinject
, one-per-module and many-per-container types must implement theOnePerModuleType
andManyPerContainerType
interfaces. These interfaces actually serve as good indicators to users for what they can put into and out of the container.It might be useful for debugging purposes to require such an interface for all types that can be injected. Currently, we need to communicate with documentation how types are supposed to use. If we required an
Injectable
interface for other injectable types (besides one-per-module and many-per-container),depinject
could return an error before it even tries to resolve dependencies that a type isn't intended to be injected.The downside of this is that types that currently don't know about
depinject
couldn't be injected directly and instead would need a wrapper type.Hard to say if the benefits outweigh the downsides. Would be good to get feedback on usability as we work with this tool.
The text was updated successfully, but these errors were encountered: