Typing logic