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

async and generator methods break with un-jsx #139

Open
j4k0xb opened this issue Feb 17, 2025 · 1 comment
Open

async and generator methods break with un-jsx #139

j4k0xb opened this issue Feb 17, 2025 · 1 comment
Labels
bug Something isn't working scope: unminify

Comments

@j4k0xb
Copy link

j4k0xb commented Feb 17, 2025

Describe the bug

  • async methods are converted to arrow functions without async.
  • generator methods are converted to arrow functions, and js has no syntax to represent generator arrow functions.

Input code

React.createElement("button", {
  async onClick() {
    await foo();
  },
  *foo() {
    yield foo();
  },
});

Reproduction

https://wakaru.vercel.app/#eNpdjrsOwjAMRX8l8tSiUJU1jIgfYKUMITVVoI2rxDyqqP9OQmHBg3V17pHsCA/0wZIDtZFgqEVQcEBtuDIeNeO+xwEdFw2c78zkGpAiNk4IHSZnBLldb82tKBeY8FNbFheiotxmMsu8Vx/wcyaLffvnzDmChEGPo3UdqAh1eiWd9tO6rq4B5lQi628TwQ4jeQZ1PEnA15Jjklh3Iac0byKTR18=

Steps to reproduce

No response

Expected behavior

<button
  onClick={async () => {
    await foo();
  }}
  foo={function* () {
    yield foo();
  }} />;

Actual behavior

<button
  onClick={() => {
    await foo();
  }}
  foo={() => {
    yield foo();
  }} />;
@pionxzh pionxzh added bug Something isn't working and removed pending triage labels Feb 17, 2025
@pionxzh
Copy link
Owner

pionxzh commented Feb 17, 2025

nice catch. I should revise all of the method related code scanning...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working scope: unminify
Projects
None yet
Development

No branches or pull requests

2 participants