facebook/idx

Can't make babel-plugin-idx works with async function

Closed this issue · 2 comments

Description

Everything is working fine until I use idx inside async function

const obj = { a: 0, b: { c: 1 } }

const Working = () => {
  idx(obj, _ => _.b.c)
}

const notWorking = async () => {
  idx(obj, _ => _.b.c)
}

I'm getting this :

capture d ecran 2017-03-16 a 11 12 12

babel config :

"babel": {
    "presets": [
      [
        "es2015",
        {
          "modules": false
        }
      ],
      "react",
      "stage-0"
    ],
    "plugins": [
      "idx",
      [
        "transform-runtime",
        {
          "helpers": false,
          "polyfill": false
        }
      ]
    ]
  }

Looks like t.isArrowFunctionExpression might only be returning true for non-async functions (if I'm reading babel-types/README.md correctly).

I would most welcome a PR if you're up for it!