synthesize __required_keys__ and __optional_keys__ for TypedDicts#4085
Closed
yangdanny97 wants to merge 1 commit into
Closed
synthesize __required_keys__ and __optional_keys__ for TypedDicts#4085yangdanny97 wants to merge 1 commit into
yangdanny97 wants to merge 1 commit into
Conversation
Summary: During attribute lookup we fall back to `dict` instead of `TypedDictFallback` for TypedDicts, which is a usability tradeoff since dict more closely models the runtime value but allows some operations (mutation) that may not be safe. Unfortunately it means that some things only present on TypedDicts are missing, so this diff synthesizes them. fixes facebook#3745 Differential Revision: D111085718
Contributor
|
@yangdanny97 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D111085718. |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
grievejia
requested changes
Jul 8, 2026
grievejia
left a comment
Contributor
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
grievejia
approved these changes
Jul 12, 2026
grievejia
left a comment
Contributor
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
Contributor
|
This pull request has been merged in bab341d. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
During attribute lookup we fall back to
dictinstead ofTypedDictFallbackfor TypedDicts, which is a usability tradeoff since dict more closely models the runtime value but allows some operations (mutation) that may not be safe.Unfortunately it means that some things only present on TypedDicts are missing, so this diff synthesizes them.
fixes #3745
Differential Revision: D111085718