# Is union abstract type?

**URL:** https://discourse.julialang.org/t/is-union-abstract-type/123782
**Category:** General Usage
**Created:** [December 12, 2024, 6:59pm UTC](https://discourse.julialang.org/t/is-union-abstract-type/123782 "2024-12-12T18:59:18Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![garazha-ilya](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/garazha-ilya/32/214384_2.png) [@garazha-ilya](https://discourse.julialang.org/u/garazha-ilya)
#### Post date: [December 12, 2024, 6:59pm UTC](https://discourse.julialang.org/t/is-union-abstract-type/123782/1 "2024-12-12T18:59:18Z")

</div>

Despite the fact that the [documentation says](https://docs.julialang.org/en/v1/manual/types/#Type-Unions) that union is an abstract type, the `isabstracttype()` function returns false:

```julia
IntOrString = Union{Int,AbstractString}
isabstracttype(IntOrString)

```

```julia
false

```

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [December 12, 2024, 7:02pm UTC](https://discourse.julialang.org/t/is-union-abstract-type/123782/2 "2024-12-12T19:02:26Z")

</div>

This is the documented behavior of `isabstracttype`:

> Determine whether type `T` was declared as an abstract type (i.e. using the `abstract type` syntax). Note that this is **not the negation** of `isconcretetype(T).` _[emphasis added]_

It sounds like you want `!isconcretetype`, e.g.

```julia
julia> !isconcretetype(IntOrString)
true

```

---

<div class="post-metadata">

### Author: ![garazha-ilya](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/garazha-ilya/32/214384_2.png) [@garazha-ilya](https://discourse.julialang.org/u/garazha-ilya)
#### Post date: [December 12, 2024, 7:23pm UTC](https://discourse.julialang.org/t/is-union-abstract-type/123782/3 "2024-12-12T19:23:16Z")

</div>

Thank you! That’s exactly what I wanted!)

---

<div class="post-metadata">

### Author: ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)
#### Post date: [December 12, 2024, 10:15pm UTC](https://discourse.julialang.org/t/is-union-abstract-type/123782/4 "2024-12-12T22:15:33Z")

</div>

Related doc issue:

> <https://github.com/JuliaLang/julia/issues/53118>
>
> Sometimes when the docs say "abstract", it means a type declared with \`abstract …type\`. In other occasions, it refers to any type that's not concrete. For clarity and consistency, I propose that all instances of the latter usage be replaced, e.g., with "non-concrete".
> 
> xref #48142
> 
> Examples:
> 
> \* The \[\`Union\`\](https://docs.julialang.org/en/v1.11-dev/base/base/#Core.Union) doc string says: "Like other abstract types"
> \* The \[\`Tuple\`\](https://docs.julialang.org/en/v1.11-dev/base/base/#Core.Tuple) doc string says: "\`Tuple{Any}\` is considered an abstract type"
