Improve warnings for invalid types

[Delivers #79556166]