In this article, we study the prehistory of type theory up to 1910 and its development between Russell and Whitehead's Principia Mathematica (, 1910-1912) and Church's simply typed ¿-calculus of 1940. We first argue that the concept of types has always been present in mathematics, though nobody was incorporating them explicitly as such, before the end of the 19th century. Then we proceed by describing how the logical paradoxes entered the formal systems of Frege, Cantor and Peano concentrating on Frege's Grundgesetze der Arithmetik for which Russell applied his famous paradox and this led him to introduce the first theory of types, the Ramified Type Theory (RTT). We present RTT formally using the modern notation for type theory and we discuss how Ramsey, Hilbert and Ackermann removed the orders from RTT leading to the simple theory of types STT. We present STT and Church's own simply typed ¿-calculus (¿ ¿ C) and we finish by comparing RTT, STT and ¿ ¿C.