question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"export default async function" wraps function in parenthesis

See original GitHub issue

"export default async function" adds an unnecessary parenthesis around the entire function:

export default async function foo() {
  console.log('Hello, World');
}

turns into:

export default (async function foo() {
  console.log("Hello, World!");
});

If I remove either the "default" or "async" modifiers, this issue is no longer triggered.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
existentialismcommented, Feb 14, 2017

It’s due to an upstream issue in Babylon (fixed: https://github.com/babel/babylon/issues/257), and should be resolved once we ship the next Babylon release (soon!)

0reactions
vjeuxcommented, Mar 19, 2017

Looks like updating to the latest beta just works and doesn’t require any changes nor breaks anything else 😃 https://github.com/prettier/prettier/pull/1047

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why wrap Arrow function body in parentheses - Stack Overflow
Without parenthesis, the object declaration brackets {} are considered as the arrow function body which will lead a logic error.
Read more >
When should I use curly braces { } and parenthesis ( ) in React?
Curly braces { } are special syntax in JSX. It is used to evaluate a JavaScript expression during compilation. A JavaScript expression can...
Read more >
ECMAScript proposal: top-level `await` - 2ality
First attempt: immediately-invoked top-level async function #. The following module initializes its export downloadedText1 asynchronously: // ...
Read more >
Documentation - SolidJS · Reactive Javascript Library
Solid's overall approach to reactivity is to wrap any reactive computation in a function, and rerun that function when its dependencies update.
Read more >
Azure Functions bindings expressions and patterns
Most expressions are identified by wrapping them in curly braces. For example, in a queue trigger function, {queueTrigger} resolves to the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found