Skip to content

decorators cannot get type hints for async function return values #1284

Answered by JelleZijlstra
mkdir700 asked this question in Q&A
Discussion options

You must be logged in to vote

This is because async_dec is missing a return type. If I add a return type (Callable[[Callable[P, Awaitable[T]]], Callable[P, Awaitable[T]]]), both mypy and pyright correctly infer that r is an int.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mkdir700
Comment options

Answer selected by mkdir700
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
topic: other Other topics not covered
2 participants
Converted from issue

This discussion was converted from issue #1283 on November 05, 2022 14:15.