fix #15155: improve namespace module error message#15176
Conversation
f57292b to
aab25a8
Compare
sandersn
left a comment
There was a problem hiding this comment.
I would remove the new test since it's redundant. After that, 👍
| @@ -0,0 +1,9 @@ | |||
| namespace z {} | |||
There was a problem hiding this comment.
Call me crazy, but I don't actually think we need a new test for this change. 🐱 memberScope.errors.txt and importDeclWithDeclareModifier.errors.txt, for example, show exactly the improved error message that is intended.
| var a: A; // error | ||
| ~ | ||
| !!! error TS2304: Cannot find name 'A'. | ||
| !!! error TS2708: Cannot use namespace 'A' as a value here because it has no value export. |
There was a problem hiding this comment.
The more specific error here is now wrong instead of being vague.
I think I like 'wrong' over 'vague' though.
There was a problem hiding this comment.
I have polished the error message. Now it will tell if namespace is used as value or type.
| "category": "Error", | ||
| "code": 2707 | ||
| }, | ||
| "Cannot use namespace '{0}' as a value here because it has no value export.": { |
There was a problem hiding this comment.
Cannot use namespace '{0}' as a value.
|
Thanks for the further improvement in the error message. The final change is very nice. |
Fixes #15155