-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
Bug Report
Using TypedDict
's alternative functional syntax as a base class produces a Unsupported dynamic base class "TypedDict" [misc]
error.
To Reproduce
Gist: https://mypy-play.net/?mypy=latest&python=3.12&gist=78872722658fe7bd5042cba6318b0432
Expected Behavior
I'd expect a call to TypedDict
to be allowed to be used as a base class:
class Params(
TypedDict( # This should work
"Params",
{"is": NotRequired["str"]},
),
):
pass
a: Params = { "is": "a" } # Produces misleading error
Actual Behavior
Instead, it produces the following errors:
main.py:4: error: Unsupported dynamic base class "TypedDict" [misc]
main.py:11: error: Incompatible types in assignment (expression has type "dict[str, str]", variable has type "Params") [assignment]
Your Environment
- Mypy version used: 1.7.1
- Mypy command-line flags: N/A
- Mypy configuration options from
mypy.ini
(and other config files): N/A - Python version used: 3.12
sklakshminarayanan-r7