Type issue in for loop over items in struct field

No @cases needed (fortunately). With a sum type from DynamicSumTypes you would need to use variant to obtain the type, but then yes, you can just use normal dispatch. See the readme of DynamicSumTypes DynamicSumTypes.jl/README.md at main · JuliaDynamics/DynamicSumTypes.jl · GitHub for more info. With a Union you will not need to do anything at all.