* handle tuple types * fix that one guy * add test
@@ -1604,6 +1604,8 @@ def _determine_value_of_array_index(
return args[0] if args else Any
if origin_var_type is tuple:
args = get_args(var_type)
+ if len(args) == 2 and args[1] is ...:
+ return args[0]
return (
args[int(index) % len(args)]
if args and index is not None
@@ -509,6 +509,7 @@ def test_var_indexing_lists(var):
Var(_js_expr="tuple", _var_type=tuple[int, str]).guess_type(),
[int, str],
),
+ (Var.create((1, 2)), [int, int]),
],
)
def test_var_indexing_types(var, type_):