Skip to content

Mypy: DictComponentsType["_help"] is not expressed in type declaration #626

@netanel-haber

Description

@netanel-haber

🐛 Bug report

The type for DictComponentsType doesn't allow the "_help": str entry:

ComponentType = Union[Callable, Type]
DictComponentsType = Dict[str, Union[ComponentType, "DictComponentsType"]]

To reproduce

from jsonargparse import CLI
CLI({"something": {"_help": "Help"}})
> python -m mypy .
...error: Dict entry 0 has incompatible type "str": "str"; expected "str": "Callable[..., Any] | type[Any] | DictComponentsType"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions