Skip to content
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

Use the new TypeIs feature to update the notna/notnull/isna/isnull type guards #911

Open
gandhis1 opened this issue Apr 24, 2024 · 0 comments

Comments

@gandhis1
Copy link
Contributor

I originally contributed the annotations for these methods in #339. That PR has a bunch of context about how the fact that TypeGuard only narrows in the positive case, while the methods should narrow in both the positive and negative case.

TypeIs was recently introduced as a PEP and mypy added support for it, I suspect pyright as well: https://mypy-lang.blogspot.com/2024/04/mypy-110-released.html

This would allow narrowing in the negative case and fix the type narrowing semantics of these methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant