-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False positive on type alias with Annotated
and multiple type arguments upon import
#9273
Comments
Annotated
and multiple type arguments upon import
…-style generic type alias whose type is defined as a new-style type alias that has multiple type parameters, only some of which are used in its type definition. This addresses #9273.
I agree this is a bug. It will be addressed in the next release. What you're doing here is pretty suspect though. Type parameters are intended to parameterize types. Here you're using a type parameter that appears only within an |
Thank you very much for such a quick answer! You are absolutely right, i plan to use the second type parameter at runtime for other libraries that may perform checks/validation. |
This is addressed in pyright 1.1.386 |
I made a type alias with
Annotated
, which has two arguments in the generic. Everything works correctly, but as soon as i import this type alias into another file, some strange behavior occurs. Unfortunately, I couldn't reproduce other examples, so I can't pinpoint the exact issue. Eric Traut, i hope you'll be able to figure it out, though it's possible that Pyright is working as intended. I'm always open to discussion!File
foo.py
File
bar.py
The text was updated successfully, but these errors were encountered: