Skip to content

Commit

Permalink
Fix mypy error: A function returning TypeVar should receive at least …
Browse files Browse the repository at this point in the history
…one argument containing the same TypeVar
  • Loading branch information
Pietro Zambelli committed Sep 3, 2024
1 parent e13d1d8 commit c97aff6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion requirements-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pytest-cov >=2.10.0,<6.0.0
coverage[toml] >=6.2,<8.0
pytest-xdist >=1.32.0,<4.0.0
pytest-sugar >=0.9.4,<1.1.0
mypy ==1.4.1
mypy >=1.10.1
ruff ==0.6.3
# Needed explicitly by typer-slim
rich >=10.11.0
Expand Down
3 changes: 2 additions & 1 deletion typer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .models import ArgumentInfo, OptionInfo, ParameterInfo, ParamMeta

T = TypeVar("T")
TypeAliasTypeVar = TypeAliasType("TypeAliasTypeVar", value=T, type_params=(T,))


def _param_type_to_user_string(param_type: Type[ParameterInfo]) -> str:
Expand Down Expand Up @@ -200,7 +201,7 @@ def get_params_from_function(func: Callable[..., Any]) -> Dict[str, ParamMeta]:
return params


def get_original_type(alias: TypeAliasType) -> T:
def get_original_type(alias: TypeAliasTypeVar[T]) -> T:
"""Return the original type of an alias.
Examples
Expand Down

0 comments on commit c97aff6

Please sign in to comment.