trycast
trycast copied to clipboard
Use TypeIs instead of TypeGuard
The isassignable API is currently:
def isassignable(
value: object,
tp: TypeForm[T]† | TypeFormString[T]‡,
/, *, eval: bool = True
) -> TypeGuard[T]: ...
Alter it to return a TypeIs[T] instead, so that type narrowing happens as expected in the negative case, when isassignable returns False.
This change could potentially break API users, so should be marked as a major/breaking change.