improves the resource API
Def.ret => Def.tpe