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

No error when non-TypedDict base precedes TypedDict #5937

Closed
DanielRosenwasser opened this issue Sep 12, 2023 · 2 comments
Closed

No error when non-TypedDict base precedes TypedDict #5937

DanielRosenwasser opened this issue Sep 12, 2023 · 2 comments
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working

Comments

@DanielRosenwasser
Copy link
Member

from typing import TypedDict

class Person:
    name: str
    age: int

class PersonDict1(TypedDict, Person):
    #                        ~~~~~~
    # error: All base classes for TypedDict classes must also be TypedDict classes
    pass

class PersonDict2(Person, TypedDict, object):
    #                                ~~~~~~
    # error: All base classes for TypedDict classes must also be TypedDict classes
    pass

class PersonDict3(Person, TypedDict):
    # no error!
    pass

I would expect an error on all of these examples, but the last one is missing an error.

@DanielRosenwasser DanielRosenwasser added the bug Something isn't working label Sep 12, 2023
erictraut pushed a commit that referenced this issue Sep 13, 2023
…ase class within a TypedDict class statement. This addresses #5937.
@erictraut
Copy link
Collaborator

Thanks for the bug report. This will be addressed in the next release.

@erictraut erictraut added the addressed in next version Issue is fixed and will appear in next published version label Sep 13, 2023
@erictraut
Copy link
Collaborator

This is addressed in pyright 1.1.327, which I just published. It will also be included in an upcoming release of pylance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants