I could be wrong because I’ve only done this with of
loops, but you should be able to enforce a type definition on the collection (right side) which informs the typing on the item.
For example:
for (role in roles as Roles[])
This should make each element of type Roles
.