Ported type resolver into external module to add caching