"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:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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!)
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