Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant