PyRight shows errors for operator return values #303
-
Not sure when this one occurred and I guess it's not a bug but now every operator have this issue with return value. Options I see:
Any ideas for workarounds that wouldn't need creating new variables just to avoid typing issues? import bpy
class Test(bpy.types.Operator):
def execute(self, context):
# Method "execute" overrides class "Operator" in an incompatible manner
# Return type mismatch: base method returns type "set[Literal['RUNNING_MODAL', 'CANCELLED', 'FINISHED', 'PASS_THROUGH', 'INTERFACE']]", override returns type "set[str]"
# "set[str]" is incompatible with "set[Literal['RUNNING_MODAL', 'CANCELLED', 'FINISHED', 'PASS_THROUGH', 'INTERFACE']]"
# Type parameter "_T@set" is invariant, but "str" is not the same as "Literal['RUNNING_MODAL', 'CANCELLED', 'FINISHED', 'PASS_THROUGH', 'INTERFACE']"
return {"FINISHED"} |
Beta Was this translation helpful? Give feedback.
Answered by
JonathanPlasse
Aug 12, 2024
Replies: 2 comments 6 replies
-
|
Beta Was this translation helpful? Give feedback.
6 replies
-
This discussion is now solved by #300. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, this is a compromise.
Either we have auto-completion and type checking of the return literals but being more verbose or less verbose but not auto-completion and type checking.
This is really sad that microsoft/pyright/issues/8647 is not fixable.
What would you prefer?