pytype
pytype copied to clipboard
Support PEP 647: TypeGuard
I'd like to start using https://www.python.org/dev/peps/pep-0647/ in typeshed. Do you have any plans in that direction already?
I can look into adding basic support to unblock typeshed, which would mean simply interpreting TypeGuard[...]
as an alias for bool
.
No plans yet, but as you said, it shouldn't be too difficult for us to just interpret TypeGuard
as bool
for now.
I should have some time to do this tomorrow afternoon.
Thanks!
I've implemented rewriting TypeGuard[X] to bool in stubs; I'll try to do a release tomorrow.
Ok, pytype 2021.05.14 is out. Please let me know if you run into any issues using TypeGuard in stubs.
Thanks again!
We've got a basic implementation of TypeGuard done. It'll be in the next release, hopefully tomorrow.