Address some performance problems in lib/types.js.

The biggest offender was that we fell back to calling this.checkAllFields
every time we couldn't infer the Def associated with a field.