Also check non-class type hints for internal classes
Fixes #1665