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
When a base TypedDict is defined in sys.version_info branches, mypy does not pick it as a proper TypedDict base.
To Reproduce
fromtypingimportRequired, TypedDictclassBase(TypedDict):
foo: intBestBase=BaseclassChild(BestBase):
baz: Required[int] # E: Required[] can be only used in a TypedDict definition
sterliakov
changed the title
TypedDict defined in sys.version_info guards is not recognized as a TypedDict base
Alias of a TypedDict not recognized as a TypedDict base
Mar 29, 2025
Bug Report
Follow-up after #18850 discovery.
When a base
TypedDict
is defined insys.version_info
branches,mypy
does not pick it as a properTypedDict
base.To Reproduce
Or playground
Expected Behavior
sys.version_info
is a recognized guard, soChild
should be treated as regularTypedDict
.Actual Behavior
Your Environment
mypy.ini
(and other config files): N/AThe text was updated successfully, but these errors were encountered: