Skip to content

Mypy complains about method decorated with with_annotated decorator #1684

@neoniobium

Description

@neoniobium

Problem

Mypy complains about methods decorated with with_annotated when using strict settings.

How to reproduce

class App(Cmd):

    @with_annotated
    def do_something(...) -> None:  # <- Mypy complains here
        ...

Expected behavior

Mypy does not complain.

Actual behavior

Mypy reports:

...: error: Type of decorated function contains type "Any" ("Callable[..., Any]")  [misc]
        def do_something(...)

I think this can be fixed by using ParamSpec instead of the ellipsis notation (Callable[..., Any]). I have not verified it yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions