-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Fix crash when trying to import a non-exported type #36619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -2530,7 +2530,7 @@ namespace ts { | |||
: error(name, Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported, moduleName, declarationName); | |||
|
|||
addRelatedInfo(diagnostic, | |||
createDiagnosticForNode(localSymbol.valueDeclaration, Diagnostics._0_is_declared_here, declarationName) | |||
createDiagnosticForNode(localSymbol.valueDeclaration ?? localSymbol.declarations[0], Diagnostics._0_is_declared_here, declarationName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There could be more than one declaration, but exporting any of them will fix the error, so 🤷♂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also report an error on all of them which might feel cleaner and work well too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd probably just avoid the ...map
and use forEach
but whatever you'd prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding related info on each declaration instead, but looks good.
👍 updated |
@typescript-bot cherry-pick this to release-3.8 |
I've heard the bot is having trouble because of octokit. |
This should probably go in the RC since 2 people just reported errors on it in the VS Code codebase. |
* Fix crash when trying to import a non-exported type * Add related info on each declaration
Fixes #36592
Fixes #36614