Skip to content

"error: Invalid type" when inheriting from a generic class with not all type variables fixed #1936

Closed
@jstasiak

Description

@jstasiak

Code taken straight from typing documentation (https://docs.python.org/3/library/typing.html#typing.Generic):

from typing import TypeVar, Mapping

T = TypeVar('T')

class MyDict(Mapping[str, T]):
    pass

Outcome (with both latest mypy from PyPI and development version):

% python -m mypy qwe.py
qwe.py:5: error: Invalid type "qwe.T"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions