https://github.com/python/mypy/labels/topic-typeguard
topic-type-variables
from typing import TypeGuard, TypeVar, Callable
T = TypeVar("T")
def guard(x: object) -> TypeGuard[str]:
return True
def f(fn: Callable[[object], T]) -> T:
return fn(1)
reveal_type(f(guard)) # Any
This should be bool, not Any