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

Don't add parens when arrow function is part of a default assign #1540

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

Nefsen402
Copy link
Contributor

In the case of this code snippet:

const myFunction = (callback = () => {}) {
  callback();
}

Terser would insert parenthesis in the default parameter like this:

const myFunction = (callback = (() => {})) {
  callback();
}

They aren't needed, so don't generate them.

Nefsen402 added a commit to Nefsen402/destam-dom that referenced this pull request Jun 24, 2024
…ual files

This lets us implement additional tricks. Note that this does not yet
generate an optimal output because of:
terser/terser#1540
@fabiosantoscode
Copy link
Collaborator

Thank you very much!

@fabiosantoscode fabiosantoscode merged commit cc7ac7c into terser:master Jun 25, 2024
10 checks passed
@Nefsen402 Nefsen402 deleted the default-assign branch June 25, 2024 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants