facebook/regenerator

AsyncFunction is not an AsyncFunction

bertho-zero opened this issue · 0 comments

I haven't seen any mention of AsyncFunction in regenerator, are there any plans to create a polyfill or something like that?

https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/AsyncFunction

The following code works in the Chrome console but not with a babelified code, the result of instanceof is always true:

const AsyncFunction = Object.getPrototypeOf(async () => {}).constructor;

async function asyncMethod() {}
function method() {}

console.log(asyncMethod instanceof AsyncFunction) // true
console.log(method instanceof AsyncFunction) // false, but true with babelified code

console.log(asyncMethod.constructor.name) // should be "AsyncFunction", but "Function" with babelified code

I don't know if this is the role of regenerator or babel, here is the corresponding issue on the babel repo: babel/babel#8642