Fix SingleParam types for pyright checking #471
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What was changed
Explicitly specify
__arg
is a position argument inMethod*SingleParam
types.Why?
After updating pyright from 1.1.338 to 1.1.348 (following pylance release cycle), type check and inference related to
client.execute_workflow
andworkflow.execute_activity
are failing because of parameter name mismatch with__arg
. Causing pyright rejecting the correct overloads.This can be reproduced with the code sample in the collapsed block. Trying to guide pyright with type hinting on
MethodAsyncSingleParam
shows why the overload got rejected. The problem is "Parameter name mismatch"I guess python sdk won't use the method types by keyword but only use them with position argument. So this change signal the sdk's intent to type checker.
After adding the last
/
in the type pyright is passing.Sample
Checklist
I guess testing this within the repo relies on #420? If this passes mypy on CI this PR should be good enough...?