Skip to content

[Feature Request] is_subhint(SomeTypedDict, AnotherTypedDict) raises TypeError, because CPython hates TypedDict users 😭  #534

@maharjun

Description

@maharjun

Although TypedDicts are not meant for runtime checking, there are times where I want to implement a type narrower to a typeddict. To implement a generic type narrower for any dict, I'd like to know that the type to be narrowed to is a typed dict. I tried using is_subhint, but that essentially raised an error complaining that TypedDict cannot be used with subclass checks. I think when checking for subtypes for TypedDicts, one must explicitly check that the annotations are subhints of each other. Is it possible/worth it to implement this?

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