After a recent update, we get lots of pyright complains when assigning the return value of rx.cond to an argument that expects a literal value (e.g. color_scheme).
Argument of type "Var[str]" cannot be assigned to parameter "color_scheme" of type "Var[Literal['amber', 'blue', 'bronze', 'brown', 'crimson', 'cyan', 'gold', 'grass', 'gray', 'green', 'indigo', 'iris', 'jade', 'lime', 'mint', 'orange', 'pink', 'plum', 'purple', 'red', 'ruby', 'sky', 'teal', 'tomato', 'violet', 'yellow']] | Literal['amber', 'blue', 'bronze', 'brown', 'crimson', 'cyan', 'gold', 'grass', 'gray', 'green', 'indigo', 'iris', 'jade', 'lime', 'mint', 'orange', 'pink', 'plum', 'purple', 'red', 'ruby', 'sky', 'teal', 'tomato', 'violet', 'yellow'] | None" in function "call"
Type "Var[str]" is not assignable to type "Var[Literal['amber', 'blue', 'bronze', 'brown', 'crimson', 'cyan', 'gold', 'grass', 'gray', 'green', 'indigo', 'iris', 'jade', 'lime', 'mint', 'orange', 'pink', 'plum', 'purple', 'red', 'ruby', 'sky', 'teal', 'tomato', 'violet', 'yellow']] | Literal['amber', 'blue', 'bronze', 'brown', 'crimson', 'cyan', 'gold', 'grass', 'gray', 'green', 'indigo', 'iris', 'jade', 'lime', 'mint', 'orange', 'pink', 'plum', 'purple', 'red', 'ruby', 'sky', 'teal', 'tomato', 'violet', 'yellow'] | None"
"Var[str]" is not assignable to "Var[Literal['amber', 'blue', 'bronze', 'brown', 'crimson', 'cyan', 'gold', 'grass', 'gray', 'green', 'indigo', 'iris', 'jade', 'lime', 'mint', 'orange', 'pink', 'plum', 'purple', 'red', 'ruby', 'sky', 'teal', 'tomato', 'violet', 'yellow']]"
Type parameter "VAR_TYPE@Var" is covariant, but "str" is not a subtype of "Literal['amber', 'blue', 'bronze', 'brown', 'crimson', 'cyan', 'gold', 'grass', 'gray', 'green', 'indigo', 'iris', 'jade', 'lime', 'mint', 'orange', 'pink', 'plum', 'purple', 'red', 'ruby', 'sky', 'teal', 'tomato', 'violet', 'yellow']"
Type "str" is not assignable to type "Literal['amber', 'blue', 'bronze', 'brown', 'crimson', 'cyan', 'gold', 'grass', 'gray', 'green', 'indigo', 'iris', 'jade', 'lime', 'mint', 'orange', 'pink', 'plum', 'purple', 'red', 'ruby', 'sky', 'teal', 'tomato', 'violet', 'yellow']"
"str" is not assignable to type "Literal['amber']"
"str" is not assignable to type "Literal['blue']"
"str" is not assignable to type "Literal['bronze']"
"str" is not assignable to type "Literal['brown']"
... (reportArgumentType)
Describe the bug
Not sure if this is really a bug, maybe rather a feature request, but since it wasn't a problem in previous versions, I'm considering it a bug for now
After a recent update, we get lots of pyright complains when assigning the return value of rx.cond to an argument that expects a literal value (e.g.
color_scheme).To Reproduce
Running pyright gives the following error:
Expected behavior
Since both "red" and "green" are in the list of literals, I'd expect this type check to pass.
Not sure if this can easily be achieved in Python but at least in previous versions, this was not an issue.
Specifics (please complete the following information):