Refactor cast methods onto types.