We show that if n sets in a topological space are given so that all the sets are closed or all are open, and for each k ≤ n every k of the sets have a (k − 2)-connected union, then the n sets have a point in common. As a consequence, we obtain the following starshaped version of Helly's theorem: If every n + 1 or fewer members of a finite family of closed sets in Rn have a starshaped union, then all the members of the family have a point in common. The proof relies on a topological KKM-type intersection theorem.