Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TypedDict functional syntax as class base type #16703

Merged
merged 2 commits into from
Jan 14, 2024

Conversation

anniel-stripe
Copy link
Contributor

@anniel-stripe anniel-stripe commented Dec 22, 2023

Fixes #16701

This PR allows TypedDict(...) calls to be used as a base class. This fixes the error emitted by mypy described in #16701 .

Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

steam.py (https://github.com/Gobot1234/steam.py)
- steam/types/app.py:171: error: Unsupported dynamic base class "TypedDict"  [misc]
- steam/types/app.py:173: error: NotRequired[] can be only used in a TypedDict definition  [valid-type]
- steam/types/app.py:177: error: NotRequired[] can be only used in a TypedDict definition  [valid-type]
- steam/types/app.py:178: error: NotRequired[] can be only used in a TypedDict definition  [valid-type]

@anniel-stripe
Copy link
Contributor Author

Sorry for the direct mention, but bumping @JukkaL / @hauntsaninja

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks like pyright supports this syntax as well

@hauntsaninja hauntsaninja merged commit b1fe23f into python:master Jan 14, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow TypedDict functional syntax as base class
2 participants