Fix raw list not working in foreach (#547)

This commit is contained in:
Thomas Brandého 2023-02-16 07:21:53 +01:00 committed by GitHub
parent b4fb0df9ea
commit d0b47e1c23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,6 +36,7 @@ class Foreach(Component):
type_ = iterable.type_.__args__[0]
except Exception:
type_ = Any
iterable = Var.create(iterable) # type: ignore
if iterable.type_ == Any:
raise TypeError(
f"Could not foreach over var of type Any. (If you are trying to foreach over a state var, add a type annotation to the var.)"