Currently wrapping a function with `@task` removes...
# ask-community
h
Currently wrapping a function with
@task
removes all type signatures that the function was given and a bare
FunctionTask
is returned. Any thoughts of improving the
@task
decorator such that all type signatures persist? That would help tremendously with type-checking for flows. Happy to contribute too, if such a proposal is somewhat sensible.
k
Hey @haven, this is a bit beyond me so I’ll ask the team for you
z
Hey @haven -- I've actually investigated this quite a bit as I'd like to preserve the type signatures. Unfortunately, we don't have any simple options for retaining the signatures in a way that mypy can interpret. The clearest path forward is developing a mypy plugin that would fix the types. Users would then have to add it to their mypy config though. Once mypy supports
ParamSpec
(see https://github.com/python/mypy/issues/8645) we might be able to do something natively.
👍 1