Skip to content

Better error reporting/recovery for adjacent JSX elements #5286

Closed
@vladima

Description

@vladima

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

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions