Skip to content

Correctly type-hinting a Descriptor #1910

Answered by erictraut
d-tw asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for the bug report. Your second example (where ValueType is contravariant) should type check without errors. The check for a contravariant type variable used as a return type should ignore cases when it is part of a union. I've addressed the bug, and the fix will appear in the next release. In the meantime, you can use a # type: ignore comment to suppress the errors.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by d-tw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants