Description
When function that has Any
in it's signature, the safe
decorator will generate a function with type hints def (*Any, **Any) -> Any
.
Example:
@safe
def send(text: str) -> Any:
return "test"
reveal_type(send) # Revealed type is 'def (*Any, **Any) -> Any'
If the return type hint is str
the safe
decorator will produce a correctly typed function.
The problem isn't strictly related to the return type, sometimes if we have an argument that is Dict[str, Any]
the function signature would be wrong. This doesn't always occur, it takes that there are other arguments defined too (?) EDIT: it looks like it only happens with async
functions.
Is this a known issue? i.e. if Any
is present the safe
decorator makes the function arguments and return type Any
too? This may be the issue with other decorators too, I haven't tested it.
I would be glad to help to solve the issue.