Skip to content
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

Fix crash on attempting to suggest a ts import for a synthetic js resolution #41467

Merged
merged 3 commits into from
Nov 11, 2020

Conversation

weswigham
Copy link
Member

Fixes #41410

After looking at it a bit, I realized we were checking if ignoreErrors was set, but were unconditionally making a diagnostic because we wanted to try and offer a suggestion (namely, a suggestion to try to install types for it when the js seems to be present, but not any types). I simply changed our suggestion-or-error adding function to more gracefully handle the psuedo-synthetic nodes we use for some compiler-option-added imports. Now that I know how it works, I can say it was theoretically possible to trigger the same issue with importHelpers, but you'd have needed to have a tslib on disk with no accompanying types, which is obviously not what we distribute (therefore very unlikely to occur).

@weswigham weswigham added this to the TypeScript 4.1.2 milestone Nov 9, 2020
@typescript-bot typescript-bot added the For Milestone Bug PRs that fix a bug with a specific milestone label Nov 9, 2020
Comment on lines 1094 to 1095
if (location.pos < 0 || location.end < 0) {
// Psuedo-synthesized input node
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (location.pos < 0 || location.end < 0) {
// Psuedo-synthesized input node
// Pseudo-synthesized input node
if (location.pos < 0 || location.end < 0) {

@weswigham weswigham merged commit a5606ec into microsoft:master Nov 11, 2020
@weswigham
Copy link
Member Author

@typescript-bot cherry-pick this into release-4.1

@typescript-bot
Copy link
Collaborator

typescript-bot commented Nov 11, 2020

Heya @weswigham, I've started to run the task to cherry-pick this into release-4.1 on this PR at 4459504. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

Hey @weswigham, I couldn't open a PR with the cherry-pick. (You can check the log here). You may need to squash and pick this PR into release-4.1 manually.

weswigham added a commit that referenced this pull request Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4.1 RC crashes when new JSX factory is used with incremental mode
4 participants