# Help with structures using \`Val\`

**URL:** <https://discourse.julialang.org/t/help-with-structures-using-val/13300>\
**Category:** General Usage\
**Created:** [August 12, 2018, 2:28pm UTC](https://discourse.julialang.org/t/help-with-structures-using-val/13300 "2018-08-12T14:28:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [August 12, 2018, 2:28pm UTC](https://discourse.julialang.org/t/help-with-structures-using-val/13300/1 "2018-08-12T14:28:10Z")

</div>

Hi guys,

Can anyone explain me why this code is not working:

```julia
struct Design_Variable{T<:Union{Type{Val{:MGEO_Canonical}},
                                Type{Val{:MGEO_Var}}}}
    bits::Int64
    min::Float64
    max::Float64
    full_scale::Int64
    index::Int64
    name::AbstractString
end

```

```julia-repl
julia> Design_Variable{Val{:MGEO_Canonical}}(10,10.,10.,10,10,"Var")
ERROR: TypeError: in Design_Variable, in T, expected T<:Union{Type{Val{:MGEO_Canonical}}, Type{Val{:MGEO_Var}}}, got Type{DataType}

```

---

<div class="post-metadata">

**Author:** ![saschatimme](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/saschatimme/32/10313_2.png) [@saschatimme](https://discourse.julialang.org/u/saschatimme)\
**Post date:** [August 12, 2018, 2:40pm UTC](https://discourse.julialang.org/t/help-with-structures-using-val/13300/2 "2018-08-12T14:40:30Z")

</div>

This works

```julia
struct Design_Variable{T<:Union{Val{:MGEO_Canonical},
                                       Val{:MGEO_Var}}}
           bits::Int64
           min::Float64
           max::Float64
           full_scale::Int64
           index::Int64
           name::AbstractString
end

```

since `Val` is already a type. The `Type{..}` is only necessary in annotations and not as a type parameter.
