# Type Intersection in Arrays

**URL:** <https://discourse.julialang.org/t/type-intersection-in-arrays/12035>\
**Category:** General Usage\
**Created:** [June 28, 2018, 2:19pm UTC](https://discourse.julialang.org/t/type-intersection-in-arrays/12035 "2018-06-28T14:19:59Z")\
**Posts on this page:** 1\
**Showing post:** 31

<div class="post-metadata">

**Author:** ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)\
**Post date:** [July 2, 2018, 9:06am UTC](https://discourse.julialang.org/t/type-intersection-in-arrays/12035/31 "2018-07-02T09:06:28Z")

</div>

I guess we need a function like this:

```julia
function promote_entries(A::AbstractArray)
    T = mapreduce(typeof, promote_type, A)
    convert(Array{T}, A)
end

```

Currently this doesn’t seem to be optimized when `A` is homogeneous, which is a bit annoying but could easily be fixed by handling that situation manually.

---

_[View the full topic](https://discourse.julialang.org/t/type-intersection-in-arrays/12035)._
