"Understanding Machine Learning: From Theory to Algorithms" the universal approximation theorem I'm readying on "Understanding Machine Learning: From Theory to Algorithms" the Universal approximation theorem:


  ..."Networks are universal approximators. That is, for every fixed precision parameter, $\epsilon &gt;0 $, and every Lipschitz function $f : [−1; 1]^{n} \rightarrow [−1; 1]$, it is possible to
  construct a network such that for every input $\textbf{x} \in [−1; 1]^{n}$, the network outputs
  a number between $f(x) − \epsilon$ and $f(x) + \epsilon$". 


It seems to me that the function $f : [−1; 1]^{n} \rightarrow [−1; 1]$ is Boolean. 

I think that the n-dimensional unit hypercube ${\displaystyle [-1,1]^{n}}$ can be replaced with a compact set of $ \mathbb{R} ^ {n} $ but the codomain makes me puzzled. 

I was expecting a function:
$f : \mathbb { R } ^ { n } \rightarrow \mathbb { R }$
Yes, it is applicable to a Boolean function and you can modify the result to compact set. 

A result where the codomian is $[-1, 1]$ would cover regression and not restricting ourself to boolean. 

You might or might not have a result for $f: \mathbb{R}^n \to \mathbb{R}$. A theorem states what conditions it requires in order to hold, for conditions that are not promised by a theorem, you have to check carefully whether the same conclusion can still apply. In particular, if the proof uses compactness, then you can't replace $[-1,1]$ with $\mathbb{R}$.