Replies: 1 comment 2 replies
-
Please refer to this documentation. If you have further questions after reading the pyright documentation, feel free to post back here. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The first function does not typecheck but the second one does. Mypy suggests adding a type annotation to
b
on the first function, but it really feels like this is something the type inference should be able to figure out itself. Am I wrong for thinking this, or is this a bug? Is there a different of preventing this narrowing besides "collapse all expressions" or "use an annotation"? I would appreciate one or two sentences of theoretical background on why this is a problem in my code if it is not a bug :)Beta Was this translation helpful? Give feedback.
All reactions