Replies: 1 comment
-
Pyright is working as intended here. Type narrowing applies only to subexpressions that are found in the type guard expression (the conditional check). It does not track relationships between types of symbols. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Tested on pyright 1.1.379, python 3.11.9
Intuitively it seems like
y
should be narrowed here. And also in the looser case whereT
isn't constrained. I might be missing something though?Beta Was this translation helpful? Give feedback.
All reactions