# Type union over set of values

**URL:** <https://discourse.julialang.org/t/type-union-over-set-of-values/23551>\
**Category:** General Usage\
**Tags:** question\
**Created:** [April 26, 2019, 12:12pm UTC](https://discourse.julialang.org/t/type-union-over-set-of-values/23551 "2019-04-26T12:12:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [April 26, 2019, 12:12pm UTC](https://discourse.julialang.org/t/type-union-over-set-of-values/23551/1 "2019-04-26T12:12:23Z")

</div>

How can I denote the set of types `Val{x}` where `x` is a `Symbol`?

Something like `Val{S} where {S isa Symbol}`, but this is not a legal expression. Is there a way to express such a `Union` type in Julia?

This is a particular example of a parametric type union where the parameter is restricted to a set of values, instead of a set of types.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [April 26, 2019, 12:20pm UTC](https://discourse.julialang.org/t/type-union-over-set-of-values/23551/3 "2019-04-26T12:20:03Z")

</div>

You can’t express this constraint using only the type system. But you can create a wrapper type that has nothing but a type parameter and validates that it is a `Val` with a `Symbol` as type parameter.
