A map $T$ is affine if $T(\sum_{i=1}^n\lambda_i x_i) = \sum_{i=1}^n \lambda_i T(x_i)$ whenever $\sum_{i=1}^n \lambda_i = 1$. I can see that every affine map can be expressed in the form $T(x) = Ax + T(0)$ for some matrix $A$. My course notes state that this matrix can be expressed as $A = (T(e_1), T(e_2), \ldots, T(e_n))$; i.e. the $i$th column of the matrix is $T(e_i)$.
My confusion arises from this definition of $A$. Clearly $Ae_i = T(e_i)$ for all $i$, so we have $T(0) = T(x) - Ax = T(e_1) - Ae_1 = 0$, when clearly not all affine maps map the origin to itself (which is why they are affine and not linear!). Are my notes mistaken about the composition of matrix $A$, or am I missing something obvious?