diff --git a/src/sphinx_autodoc_typehints/__init__.py b/src/sphinx_autodoc_typehints/__init__.py index 8ea71c4..e67180f 100644 --- a/src/sphinx_autodoc_typehints/__init__.py +++ b/src/sphinx_autodoc_typehints/__init__.py @@ -356,7 +356,7 @@ def process_signature( # noqa: C901, PLR0913, PLR0917 sph_signature = sphinx_signature(obj, type_aliases=app.config["autodoc_type_aliases"]) typehints_formatter: Callable[..., str | None] | None = getattr(app.config, "typehints_formatter", None) - def _get_formatted_annotation(annotation): + def _get_formatted_annotation(annotation: TypeVar) -> TypeVar: if typehints_formatter is None: return annotation formatted_name = typehints_formatter(annotation) diff --git a/tests/test_integration.py b/tests/test_integration.py index 9fe8ac6..93aa1e5 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -1406,7 +1406,7 @@ def has_doctest1() -> None: """, typehints_use_signature=True, typehints_use_signature_return=True, - typehints_formatter=lambda ann, cfg=None: "Formatted", + typehints_formatter=lambda _, __=None: "Formatted", ) def typehints_formatter_applied_to_signature(param: Unformatted) -> Unformatted: """