Skip to content
This repository was archived by the owner on Feb 1, 2025. It is now read-only.

Conversation

@JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Apr 8, 2020

Context: babel/babel#10808

Transform the following snippet with only regenerator-transform

async (req) => {
  const { params } = req;
}

will throw

TypeError: /src.js: Property name expected type of string but got null
    at validate (/node_modules/@babel/types/lib/definitions/utils.js:164:13)
    at Object.validate (/node_modules/@babel/types/lib/definitions/utils.js:201:7)
    at validateField (node_modules/@babel/types/lib/validators/validate.js:22:9)
    at validate (/node_modules/@babel/types/lib/validators/validate.js:16:3)
    at builder (/node_modules/@babel/types/lib/builders/builder.js:38:27)
    at Object.Identifier (/node_modules/@babel/types/lib/builders/generated/index.js:334:31)
    at /node_modules/regenerator-transform/lib/hoist.js:32:29

Since practically every engine with native destructuring support will also have native generator support (thread). I think the value of pattern support is marginal. Hence we throw a better error.

@monsonjeremy
Copy link

🙌

@jeremytenjo
Copy link

jeremytenjo commented Apr 13, 2020

How is this error fixed?

I get the error with the following code

const hello = async () => {
  const he = { ll: '2' }
  const { ll } = he
}

More info here #391

Thanks @JLHwung

@monsonjeremy
Copy link

Any chance we can get this merged?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants