eslint / typescript-eslint-parser

An ESLint custom parser which leverages TypeScript ESTree to allow for ESLint to lint TypeScript source code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong type for JSXSpreadChild

ikatyang opened this issue · comments

commented

What version of TypeScript are you using?
3.0.0-dev.20180626

What version of typescript-eslint-parser are you using?
master (6eec85b)

What code were you trying to parse?

const x = <div>{...[0]}</div>

What did you expect to happen?

{
  "type": "ExpressionStatement",
  "expression": {
    "type": "JSXElement",
    "openingElement": {
      "type": "JSXOpeningElement",
      "attributes": [],
      "name": {
        "type": "JSXIdentifier",
        "name": "div"
      },
      "selfClosing": false
    },
    "closingElement": {
      "type": "JSXClosingElement",
      "name": {
        "type": "JSXIdentifier",
        "name": "div"
      }
    },
    "children": [
      {
        "type": "JSXSpreadChild",
        "expression": {
          "type": "ArrayExpression",
          "elements": [
            {
              "type": "Literal",
              "value": 0
            }
          ]
        }
      }
    ]
  }
}

What happened?

-        "type": "JSXSpreadChild",
+        "type": "JSXExpressionContainer",