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

AsyncFunction is not an AsyncFunction #436

Open
bertho-zero opened this issue Apr 9, 2021 · 0 comments
Open

AsyncFunction is not an AsyncFunction #436

bertho-zero opened this issue Apr 9, 2021 · 0 comments

Comments

@bertho-zero
Copy link

bertho-zero commented Apr 9, 2021

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant