-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Labels
Description
This code works with mypy:
class MyClass:
pass
di[MyClass] = MyClass()
async def my_async_func(my_class: MyClass) -> str:
return MyClass.__class__.__name__
async def calling_func() -> str:
return await my_async_func(di[MyClass])
While this code results in an error:
class MyClass:
pass
di[MyClass] = MyClass()
@inject
async def my_async_func(my_class: MyClass) -> str:
return MyClass.__class__.__name__
async def calling_func() -> str:
return await my_async_func()
mypy error: error: Incompatible types in "await" (actual type "Union[Any, Callable[..., Any]]", expected type "Awaitable[Any]")
Aside from ignoring the calling line, is there any way to make mypy happy with the type returned from the @Inject decorator?
Reactions are currently unavailable