Skip to content

Commit d13ad9e

Browse files
authored
Khaleel/eng 5281 typeerror unsupported type ellipsis for guess type (#5046)
* handle tuple types * fix that one guy * add test
1 parent 6a37754 commit d13ad9e

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

reflex/vars/sequence.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,6 +1604,8 @@ def _determine_value_of_array_index(
16041604
return args[0] if args else Any
16051605
if origin_var_type is tuple:
16061606
args = get_args(var_type)
1607+
if len(args) == 2 and args[1] is ...:
1608+
return args[0]
16071609
return (
16081610
args[int(index) % len(args)]
16091611
if args and index is not None

tests/units/test_var.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ def test_var_indexing_lists(var):
509509
Var(_js_expr="tuple", _var_type=tuple[int, str]).guess_type(),
510510
[int, str],
511511
),
512+
(Var.create((1, 2)), [int, int]),
512513
],
513514
)
514515
def test_var_indexing_types(var, type_):

0 commit comments

Comments
 (0)