# \<: union shorthand in NamedTuple type

**URL:** <https://discourse.julialang.org/t/union-shorthand-in-namedtuple-type/12178>\
**Category:** Internals & Design\
**Tags:** question\
**Created:** [July 5, 2018, 12:51pm UTC](https://discourse.julialang.org/t/union-shorthand-in-namedtuple-type/12178 "2018-07-05T12:51:30Z")\
**Posts on this page:** 3\
**Page:** 1

<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:** [July 5, 2018, 12:51pm UTC](https://discourse.julialang.org/t/union-shorthand-in-namedtuple-type/12178/1 "2018-07-05T12:51:31Z")

</div>

_(asking before opening an issue)_

```julia
f(::NamedTuple{(:a,:b), Tuple{<:AbstractFloat,<:AbstractArray}}) = :notok

f(::NamedTuple{(:a,:b), Tuple{T,S}}) where
{T<:AbstractFloat,S<:AbstractArray} = :ok

```

The first one fails with

```julia
ERROR: NamedTuple field type must be a tuple type

```

while the second one works. Aren’t they supposed to be equivalent? Is this a bug, or am I not supposed to do this? Latest `master`, ie

```julia
julia> VERSION
v"0.7.0-beta.152"

```

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [July 5, 2018, 1:12pm UTC](https://discourse.julialang.org/t/union-shorthand-in-namedtuple-type/12178/2 "2018-07-05T13:12:50Z")

</div>

Note:

```julia
julia> f(::NamedTuple{(:a,:b), Tuple{T,S} where {T<:AbstractArray, S<:AbstractArray}}) = :notok
ERROR: NamedTuple field type must be a tuple type
Stacktrace:
 [1] top-level scope at none:0

julia> f(::NamedTuple{(:a,:b), Tuple{T,S}}) where {T<:AbstractArray, S<:AbstractArray} = :ok
f (generic function with 1 method)
```

---

<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:** [July 5, 2018, 1:18pm UTC](https://discourse.julialang.org/t/union-shorthand-in-namedtuple-type/12178/3 "2018-07-05T13:18:26Z")

</div>

Thanks, this is clear (if I understand correctly, `<:` wraps in an immediate `where`).
