Skip to content

Better error reporting/recovery for adjacent JSX elements #5286

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

Closed
vladima opened this issue Oct 16, 2015 · 0 comments
Closed

Better error reporting/recovery for adjacent JSX elements #5286

vladima opened this issue Oct 16, 2015 · 0 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@vladima
Copy link
Contributor

vladima commented Oct 16, 2015

Currently code

<p></p>
<p></p>

is effectively parsed as if it was a chain of binary operators

(<p></p>) < p > </ p >

and errors that were reported are not very helpful

tt.tsx(2,4): error TS1109: Expression expected.
tt.tsx(2,8): error TS1109: Expression expected.

Incorrect AST later breaks other LS features like formatting (#5265).

Error in Babel for the same case is much more useful:

Adjacent JSX elements must be wrapped in an enclosing tag
@vladima vladima added the Suggestion An idea for TypeScript label Oct 16, 2015
RyanCavanaugh added a commit to RyanCavanaugh/TypeScript that referenced this issue Oct 16, 2015
@mhegazy mhegazy added Bug A bug in TypeScript and removed Suggestion An idea for TypeScript labels Oct 16, 2015
@mhegazy mhegazy added this to the TypeScript 1.8 milestone Oct 20, 2015
@RyanCavanaugh RyanCavanaugh added the Fixed A PR has been merged for this issue label Oct 20, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants