Skip to content

Use the new TypeIs feature to update the notna/notnull/isna/isnull type guards #911

Closed
@gandhis1

Description

@gandhis1

I originally contributed the annotations for these methods in #339. That PR has a bunch of context about how the fact that TypeGuard only narrows in the positive case, while the methods should narrow in both the positive and negative case.

TypeIs was recently introduced as a PEP and mypy added support for it, I suspect pyright as well: https://mypy-lang.blogspot.com/2024/04/mypy-110-released.html

This would allow narrowing in the negative case and fix the type narrowing semantics of these methods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions