Issue #20: Better error handling on type declaration