Closed InvincibleRMC closed 3 days ago
Allows annotating functions for type narrowing using TypeGuard or TypeIs.
For additional information relating to the specific differences between TypeGuard and TypeIs can be found here.
def is_str_type_guard(x: object) -> TypeGuard[str]: return isinstance(x, str) def is_str_type_is(x: object) -> TypeIs[str]: return isinstance(x, str)
Adds support for `typing.TypeGuard` and `typing.TypeIs`.
Description
Allows annotating functions for type narrowing using TypeGuard or TypeIs.
For additional information relating to the specific differences between TypeGuard and TypeIs can be found here.
Suggested changelog entry: