lagom
lagom copied to clipboard
Fix issue with async definitions failing the type checker
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
Another https://github.com/python/mypy/issues/5374 probably
I'm facing the exactly same issue 😞