You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think this is better solved in a library focused on runtime type checking of TypedDict. It doesn't seem like narrowing a dict to a TypedDict can ever be safe (since the dict could be manipulated by another context). I personally have only found TypedDict useful for describing i.e. dict literals in config and so I don't find this compelling.
Right now if you want to write a
TypedDict
that will work withisinstance
- you need to write:I see that people can benefit from a better API, like:
Possible problems:
mypy
right now does not allow to callisinstance
withTypedDict
subtypes:error: Cannot use isinstance() with TypedDict type
What do you think?
The text was updated successfully, but these errors were encountered: