My textbook gives the following definition of a diffeomorphism:
Let $A \subseteq \mathbb{R}^k$ and $B \subseteq \mathbb{R}^n$. We say that a function $\psi: A \to B$ is a $C^p$-diffeomorphism $(p \geq 1)$ if $\psi$ is a homeomorphism and if $\psi$ and $\psi^{-1}$ are functions of class $C^p$, in the sense that there exist open sets $\tilde{A} \subseteq \mathbb{R}^k$ and $\tilde{B} \subseteq \mathbb{R}^n$ such that $A \subseteq \tilde{A}$ and $B \subseteq \tilde{B}$ and such that $\psi$ and $\psi^{-1}$ can each be extended to $C^p$-functions over $\tilde{A}$ and $\tilde{B}$ respectively.
Note that later this definition is used in a context where $k < n$.
I was under the impression that it is impossible for a diffeomorphism to be between sets of different dimensions, see e.g. here. It seems like the definition tries to get around this by introducing $\tilde{A}$ and $\tilde{B}$, but I think that just makes $\phi$ a diffeomorphism between $\tilde{A}$ and $\tilde{B}$, which are again of different dimensions. Note that this is the second time the word diffeomorphism was defined, the first definition earlier on in the text was
Let $A, B \subset \mathbb{R}^n$ be open. A function $f: A \to B$ is a $C^p$-diffeomorphism if it is a bijection in $C^p$ and its inverse is also in $C^p$.
This definition made sense to me and the new one seems to be a slight generalization, but I don't see how it could work.