Skip to content

Detecting extra overload entries after * #20278

@jamesbraza

Description

@jamesbraza

Feature

mypy==1.18.2 is not detecting the b as extra here after the *:

from typing import overload


@overload
def some_method(a: int, **kwargs) -> None: ...
@overload
def some_method(a: str, *, b: None = None, **kwargs) -> None: ...


def some_method(a: int | str, **kwargs) -> None:
    pass

It may also be that due to **kwargs, that a type checker can't do anything here.

Pitch

Detecting extra overload parameters to keep code clean.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions