Minor improvements
Merge pull request #6935 from wmtan/ImproveTypeWithDict

Minor improvements to TypeWithDict