A uniform approach to type theory