There is no way to type this using ParamSpec/Concatenate
. PEP 612 explicitly omitted this edge case because it added a lot of implementation complexity.
The reason you got an error for your call_authenticated
example is because someone could apply that decorator to a function without a client
keyword (maybe it has a parameter with type as AuthenticatedClient
but with a different name). For example:
@call_authenticated
def foo(not_client: AuthenticatedClient) -> None: ...