Refactored common behavior from TypeAssigner and TypeErasure