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
Currently the fallback type of typed dicts is Mapping[str, join(item_types)]. This might be too limiting for some typical use cases. For example, maybe a typed dict should be compatible with Dict[str, Any] (and vice versa).
One idea is to keep the fallback like that, but special case compatibility with Dict[str, Any] (maybe also MutableMapping[str, Any]).
We may want to wait until typed dict support is more complete and try it in practice with production code before deciding what to do with this.
The text was updated successfully, but these errors were encountered:
The current behavior seems flexible enough, and it's reasonably safe (Mapping[str, object] would actually be a safer fallback due to structural subtyping). I'm proposing to close this issue.
Interoperability with Dict[str, Any] types can be achieved through explicit casts.
Currently the fallback type of typed dicts is
Mapping[str, join(item_types)]
. This might be too limiting for some typical use cases. For example, maybe a typed dict should be compatible withDict[str, Any]
(and vice versa).One idea is to keep the fallback like that, but special case compatibility with
Dict[str, Any]
(maybe alsoMutableMapping[str, Any]
).We may want to wait until typed dict support is more complete and try it in practice with production code before deciding what to do with this.
The text was updated successfully, but these errors were encountered: