Skip to content

Dont emit module resolution errors when looking up specifiers for container symbols #28558

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

Merged
merged 1 commit into from
Nov 17, 2018

Conversation

weswigham
Copy link
Member

Fixes #28538

Although I really do think it's strange we don't error on these kinds of imports.

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code change looks good, and I support not breaking people. Make sure @DanielRosenwasser signs off too, though, since he's kind of in charge of breaking (or not-breaking) changes.

function resolveExternalModuleName(location: Node, moduleReferenceExpression: Expression): Symbol | undefined {
return resolveExternalModuleNameWorker(location, moduleReferenceExpression, Diagnostics.Cannot_find_module_0);
function resolveExternalModuleName(location: Node, moduleReferenceExpression: Expression, ignoreErrors?: boolean): Symbol | undefined {
return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? undefined : Diagnostics.Cannot_find_module_0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that supposed to be a link to the diff this comment is on? Because it seems to be.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its line 2273 in the diff

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, naw that position always passes /*isError*/ false, so only manufactures suggestions, anyway. Given that it doesn't check the moduleNotFoundError flag, I assume the intent is to always generate the suggestions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the suggestion is raised only when the container name? Seems flaky then.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it probably is. I assume it was written with the estimation that the module name is resolved for all imports, rather than only-imports-with-used-exports. I didn't add the suggestion, so I'm not sure myself, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants