I saw the proofs on the derivative of $\frac{d e^x}{dx}=e^x$ from here and the one that was intriguing was this : $$e^x:=\lim_{n\to\infty}\left(1+\frac{x}{n}\right)^n \implies \frac{d(e^x)}{dx} = \lim_{n\to\infty} n\cdot \frac{1}{n}\left(1+\frac{x}{n}\right)^{n-1} = \lim_{n\to\infty}\left(1+\frac{x}{n}\right)^{n-1} = e^x$$

Now what I am curious is this:

What theorem allows you to take derivative while keeping the limit sign intact and take the limit later as above?