Open
Description
Using Injector to bind a concrete class to an abstract interface, and then getting an instance of that interface causes a mypy error:
class MyABC(ABC): pass
class MyClass(MyABC): pass
injector = Injector()
injector.binder.bind(MyABC, to=MyClass) # error: Only concrete class can be given where "Type[MyABC]" is expected
injector.get(MyABC) # error: Only concrete class can be given where "Type[MyABC]" is expected
I hope that this can be resolved by fixing type hints (although it's certainly possible to configure Injector so that the type hints will be incorrect).
Metadata
Metadata
Assignees
Labels
No labels