Fix crash when trying to import a non-exported type#36619
Merged
andrewbranch merged 2 commits intomicrosoft:masterfrom Feb 5, 2020
Merged
Fix crash when trying to import a non-exported type#36619andrewbranch merged 2 commits intomicrosoft:masterfrom
andrewbranch merged 2 commits intomicrosoft:masterfrom
Conversation
andrewbranch
commented
Feb 5, 2020
src/compiler/checker.ts
Outdated
|
|
||
| addRelatedInfo(diagnostic, | ||
| createDiagnosticForNode(localSymbol.valueDeclaration, Diagnostics._0_is_declared_here, declarationName) | ||
| createDiagnosticForNode(localSymbol.valueDeclaration ?? localSymbol.declarations[0], Diagnostics._0_is_declared_here, declarationName) |
Member
Author
There was a problem hiding this comment.
There could be more than one declaration, but exporting any of them will fix the error, so 🤷♂
Member
There was a problem hiding this comment.
You could also report an error on all of them which might feel cleaner and work well too.
Member
There was a problem hiding this comment.
I'd probably just avoid the ...map and use forEach but whatever you'd prefer.
DanielRosenwasser
approved these changes
Feb 5, 2020
Member
DanielRosenwasser
left a comment
There was a problem hiding this comment.
Consider adding related info on each declaration instead, but looks good.
Member
Author
|
👍 updated |
Member
Author
|
@typescript-bot cherry-pick this to release-3.8 |
Member
|
I've heard the bot is having trouble because of octokit. |
DanielRosenwasser
approved these changes
Feb 5, 2020
Member
|
This should probably go in the RC since 2 people just reported errors on it in the VS Code codebase. |
andrewbranch
added a commit
to andrewbranch/TypeScript
that referenced
this pull request
Feb 5, 2020
* Fix crash when trying to import a non-exported type * Add related info on each declaration
andrewbranch
added a commit
that referenced
this pull request
Feb 5, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #36592
Fixes #36614