click-contrib / click-option-group

Option groups missing in Click
https://click-option-group.readthedocs.io
BSD 3-Clause "New" or "Revised" License
103 stars 14 forks source link

Need type hints for decorator return types #49

Open vectro opened 1 year ago

vectro commented 1 year ago

Because optgroup.group and optgroup.option do not have hints on their return types. mypy generates errors at the call site like Untyped decorator makes function "cli" untyped.

I think this could be resolved by adding type hints on the return values of these functions, as described in the mypy documentation.

LecrisUT commented 1 year ago

The documentation of how to type-check decorators is rather vague, especially in order to add optional arguments. If there is any example that would help.

tecknicaltom commented 3 months ago

with the addition of the Decorator definition added in https://github.com/click-contrib/click-option-group/commit/a4684709885979585acc6767d786c217e49661da this should be fixable by adding the return type annotation -> Decorator to _OptGroup.group