ast: Create a new package types for code related to types and move existing code there.