Recall a definition of convex conjugate (taken from Wiki):
Let $X$ be a real topological vector space, and let $X^*$ be the dual space to $X.$ Denote the dual pairing by $$\langle \cdot,\cdot \rangle :X^*\times X\to\mathbb{R}.$$ For a function $f:X\to \mathbb{R}\cup \{-\infty,\infty\}$ taking values on the extended real number line, the convex conjugate $$f^*:X^*\to\mathbb{R}\cup\{-\infty,\infty\}$$ is defined in terms of the supremum by $$f^*(x^*) =\sup\{ \langle x^*,x \rangle -f(x)| x\in X \},$$ or, equivalently, in terms of the infimum by $$f^*(x^*) =-\inf\{ f(x) -\langle x^*,x \rangle | x\in X \},$$
Do we really need codomain of $f$ to be $\mathbb{R}\cup\{-\infty,\infty\}?$ Would anything go wrong if codomain of $f$ is just $\mathbb{R}?$