Skip to content

Use TypeIs instead of TypeGuard #36

@davidfstr

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.

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