lagom icon indicating copy to clipboard operation
lagom copied to clipboard

Fix issue with async definitions failing the type checker

Open meadsteve opened this issue 4 years ago • 2 comments

For this code:

    @dependency_definition(container)
    async def my_constructor() -> MyComplexDep:
        return MyComplexDep(some_number=5)

    assert (await container[Awaitable[MyComplexDep]]) == MyComplexDep(some_number=5)

mypy raises these errors:

 error: Only concrete class can be given where "Type[Awaitable[MyComplexDep]]" is expected

meadsteve avatar Jul 09 '20 18:07 meadsteve

Another https://github.com/python/mypy/issues/5374 probably

meadsteve avatar Mar 20 '21 18:03 meadsteve

I'm facing the exactly same issue 😞

thiromi avatar Sep 14 '23 08:09 thiromi