The JSXExpression union incorrectly includes JSXEmptyExpression #6315
Labels
accepting prs
Go ahead, send a pull request that resolves this issue
bug
Something isn't working
package: ast-spec
Issues related to @typescript-eslint/ast-spec
Before You File a Bug Report Please Confirm You Have Done The Following...
Relevant Package
ast-spec
Playground Link
https://typescript-eslint.io/play/#ts=4.3.5&jsx=true&sourceType=module&showAST=es&code=DwQwfA3gvsD04G4g&eslintrc=N4KABGBEBOCuA2BTAzpAXGYBfEWg&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA
Repro Code
ESLint Config
No response
tsconfig
No response
Expected Result
I expect that when using the
AST_NODE_TYPES.JSXExpression
type theAST_NODE_TYPES.JSXEmptyExpression
won't be a member of the union.Actual Result
What I see is that the definition of the union is:
Additional Info
Code like
<a>{}</a>
is parsed by typescript as aJsxExpression
node who'sexpression
value isundefined
. As part of converting the JsxExpression node to an ESLint compatible AST, thetypescript-estree
package replaces theundefined
with aJSXEmptyExpression
node (relevant code).However, in the
ast-spec
package theJSXEmptyExpression
type is a part of theJSXExpression
union (defined here). As explained above, this is incorrect as theJSXEmptyExpression
node is only created as the child of a JSXExpression.Versions
@typescript-eslint/ast-spec
5.48.0
@typescript-eslint/typescript-estree
5.48.0
The text was updated successfully, but these errors were encountered: