diff options
author | David Euresti <david@euresti.com> | 2021-12-17 12:03:41 -0800 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2021-12-28 10:25:02 -0800 |
commit | 03963b2e7de4a9f835534df75f79eea4ee04fcc3 (patch) | |
tree | 1828a605fe9b9dc07bad75c465f8a467fcd17ba4 /CHANGES.rst | |
parent | 490ac01891e726c8b70a700b91da6c137699382a (diff) | |
download | click-03963b2e7de4a9f835534df75f79eea4ee04fcc3.tar.gz |
Fix TypeVar for decorators that handle Commands
The old type var would throw away the types of Callables.
```
import click
@click.option("--name", prompt="Your name", help="The person to greet.")
def hello(name: str) -> None:
...
reveal_type(hello) # note: Revealed type is 'def (*Any, **Any) -> Any'
```
With this small adjustment mypy now knows that it's a `'def (name: builtins.str)'`
Diffstat (limited to 'CHANGES.rst')
-rw-r--r-- | CHANGES.rst | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index f46d446..92f69dc 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -7,6 +7,8 @@ Unreleased - ``open_file`` recognizes ``Path("-")`` as a standard stream, the same as the string ``"-"``. :issue:`2106` +- The ``option`` and ``argument`` decorators preserve the type + annotation of the decorated function. :pr:`2155` Version 8.0.3 |