We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
bool
TypeGuard
Consider this example:
from typing import Any, Callable from typing_extensions import TypeGuard def notguard(x: Any) -> bool: ... def hof2(func: Callable[[Any], TypeGuard[int]]): ... hof2(notguard)
Mypy throws no errors, but a bool is not a TypeGuard.
Relatedly, this example prints bool:
from typing import Any, Callable, List, TypeVar from typing_extensions import TypeGuard T = TypeVar("T") def notguard(x: Any) -> bool: ... def my_filter(func: Callable[[Any], TypeGuard[T]]) -> List[T]: ... reveal_type(my_filter(notguard))
(Extracted from work by @erictraut and @gvanrossum at python/typeshed#5406.)
The text was updated successfully, but these errors were encountered:
Duplicate of #10489 (GitHub seems to be having some issues today)
Sorry, something went wrong.
No branches or pull requests
Consider this example:
Mypy throws no errors, but a bool is not a TypeGuard.
Relatedly, this example prints
bool
:(Extracted from work by @erictraut and @gvanrossum at python/typeshed#5406.)
The text was updated successfully, but these errors were encountered: