Skip to content

Import assertion: do not parse } if { is not present #46388

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
Oct 15, 2021

Conversation

sandersn
Copy link
Member

@sandersn sandersn commented Oct 15, 2021

Previously, import assertion parsing would try to parse both { and }, even if both were missing. If both were missing, the error for } could occur past the end of the file, causing an assertion. This PR changes the code to parse {} the same way that parseBlock does.

Review with whitespace ignored.

Fixes #46364

Previously, import assertion parsing would try to parse both { and },
even if both were missing. If both were missing, the error for } could
occur past the end of the file, causing an assertion.

Fixes #46364
@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Oct 15, 2021
@sandersn sandersn changed the title Import assertion: do no parse } if { is not present Import assertion: do not parse } if { is not present Oct 15, 2021
@sandersn sandersn merged commit 6a75689 into main Oct 15, 2021
@sandersn sandersn deleted the fix-import-assertion-parsing branch October 15, 2021 20:26
mprobst pushed a commit to mprobst/TypeScript that referenced this pull request Jan 10, 2022
Previously, import assertion parsing would try to parse both { and },
even if both were missing. If both were missing, the error for } could
occur past the end of the file, causing an assertion.

Fixes microsoft#46364
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.

Crash on incomplete import assertion
3 participants