Closed AlonKellner closed 1 month ago
Pyright's behavior here is correct.
Your parameter annotations should be:
def wrap_args(*args: str):
abc(*args)
def wrap_kwargs(**kwargs: str):
abc(**kwargs)
Refer to this section of the typing spec for details.
My bad, thanks :)
Describe the bug When using variable-length arguments (i.e
func(*args)
orfunc(**kwargs)
) the inferred type for the arguments is incorrect, therefore raising areportArgumentType
error.Code or Screenshots
In this example, these are the errors:
Although from the argument types perspective there is nothing wrong here, the issue is that the inferred type set to
a
is the variable-lengthargs
type (List[str]
), not the expected expanded type (str
).Summary I am not sure where this problem comes from and I am a little out of my depth here, but if you'll point out possible causes and outline the solution I can help with the PR.