Skip to content

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

Merged
sandersn merged 1 commit into
mainfrom
fix-import-assertion-parsing
Oct 15, 2021
Merged

Import assertion: do not parse } if { is not present#46388
sandersn merged 1 commit into
mainfrom
fix-import-assertion-parsing

Conversation

@sandersn

@sandersn sandersn commented Oct 15, 2021

Copy link
Copy Markdown
Member

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
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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