sbdchd / django-types

:doughnut: Type stubs for Django
MIT License
188 stars 62 forks source link

fix: Fix type errors after upgrading pyright to 1.1.271 in `path` fun… #130

Closed last-partizan closed 2 years ago

last-partizan commented 2 years ago

…ction with async views from channels.

Screenshot from 2022-09-15 13-46-08

here is the problem, _ResponseType is defined like this:

_ResponseType = Union[HttpResponseBase, Coroutine[Any, Any, HttpResponseBase]]

But async consumer from channels is returning None, it was Unknown in previous pyright releases, so it was working.

Looking at the AsyncConsumer.__call__ signature, it is indeed does not return anything.

Coroutine[Any, Any, HttpResponseBase] is expected to handle async django views?

And we need to add Coroutine[Any, Any, None] to support channels. Is this sounds right?

sbdchd commented 2 years ago

Looks good, thank you!