Casting from a TypedDict to a Mapping can be a bit more lax
#9513
tusharsadhwani
started this conversation in
Ideas
Replies: 1 comment
-
|
The typing spec specifically disallows assignment to a more specific There is a draft PEP that defines support for "closed" TypedDicts. This PEP hasn't yet been approved, but pyright contains provisional support for the latest draft. You can try it by setting |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, this code fails type checking:
Changing the annotation of
vtoMapping[str, object]works. But since the TypedDict only containsstrfields, I think this cast should work? Is there a reason for the cast to not work right now?Beta Was this translation helpful? Give feedback.
All reactions