eslint / typescript-eslint-parser

An ESLint custom parser which leverages TypeScript ESTree to allow for ESLint to lint TypeScript source code.
Other
915 stars 92 forks source link

Wrong type for JSXSpreadChild #500

Closed ikatyang closed 5 years ago

ikatyang commented 5 years ago

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

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

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",