Skip to content

Use TypeIs instead of TypeGuard #36

Description

@davidfstr

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementEnhancement to existing feature

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions