command and group decorators are untyped on strict

Summary:
The click.command and click.group decorators are currently untyped and cause typing errors on strict pyright. (I haven't tested with mypy).

Replication:

  • Install click
  • Install pyright
# pyproject.toml

[tool.pyright]
typeCheckingMode = "strict"
# main.py

import click

@click.command()
def cli_main() -> None:
    ...

@click.group()
def cli_group() -> None:
    ...

These decorators are both unknown due to the use of typing.Callable with no generics. PR incoming.

Environment:

  • Python version: 3.10.4
  • Click version: 8.1.2