Closed
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Relevant Package
ast-spec
Playground Link
Repro Code
// This parses as a JSXExpressionContainer node whose expression is a JSXEmptyExpression node.
<a>{}</a>;
ESLint Config
No response
tsconfig
No response
Expected Result
I expect that when using the AST_NODE_TYPES.JSXExpression
type the AST_NODE_TYPES.JSXEmptyExpression
won't be a member of the union.
Actual Result
What I see is that the definition of the union is:
export type JSXExpression =
| JSXEmptyExpression
| JSXExpressionContainer
| JSXSpreadChild;
Additional Info
Code like <a>{}</a>
is parsed by typescript as a JsxExpression
node who's expression
value is undefined
. As part of converting the JsxExpression node to an ESLint compatible AST, the typescript-estree
package replaces the undefined
with a JSXEmptyExpression
node (relevant code).
However, in the ast-spec
package the JSXEmptyExpression
type is a part of the JSXExpression
union (defined here). As explained above, this is incorrect as the JSXEmptyExpression
node is only created as the child of a JSXExpression.
Versions
package | version |
---|---|
@typescript-eslint/ast-spec |
5.48.0 |
@typescript-eslint/typescript-estree |
5.48.0 |