What I Want
The projects I work on include MyPy in the testing pipeline. For "quality of life" and code readability reasons I am on a mission to reduce the need for `# type: ignore" style comments as much as possible
Proposed Solution
In my current project I am using the following wrapper:
Params = ParamSpec('Params')
ReturnVar = TypeVar('ReturnVar')
Func = Callable[Params, ReturnVar]
def typed_callback(app: Dash, *args: Any, **kwargs: Any) -> Callable[[Func], Func]:
return cast(Callable[[Func], Func], app.callback(*args, **kwargs))
I have forked the dev branch and added a typed_callback function (here: _callback.py) as a proof of concept.
I would like feedback on this idea.
(Disclosure: the tests in my fork were generated using AI)