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

Consider adding a rule that enforces using TypeIs instead of TypeGuard #12277

Open
ItsDrike opened this issue Jul 10, 2024 · 0 comments
Open
Labels
rule Implementing or modifying a lint rule

Comments

@ItsDrike
Copy link

In PEP 742, a new TypeIs annotation has been added. This provides an alternative to TypeGuard , which supports proper type narrowing. In vast majority of cases, people should use TypeIs as opposed to TypeGuard and the use of TypeGuard in code is likely a mistake.

It would therefore be nice to have a rule that bans the use of TypeGuard completely, just like the ANN401 rule, that bans typing.Any.

@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
2 participants