injectable icon indicating copy to clipboard operation
injectable copied to clipboard

Add support for autowiring with Annotated

Open lozanocampillod opened this issue 8 months ago • 1 comments

What does this PR do?

This PR adds the feature addressed at issue https://github.com/roo-oliv/injectable/issues/108

Context

I use injectable in production but when using a static type checker (mypy in our case) the Autowiring(T) type is not detected by mypy. This PR lets inject dependencies in the style proposted in the accepted solution of the aforementioned issue.

@autowired
def foo(service: Autowired(Service)): ...
@autowired
def foo(service: Annotated[Autowired(Service), foo, bar]): ...
@autowired
def foo(service: Annotated[foo, Autowired(Service), bar]): ...

lozanocampillod avatar Jun 08 '24 09:06 lozanocampillod