factor out type decls