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.

parenthesis around nested lambda functions removed incorrectly

See original GitHub issue

Prettier 1.16.4 Playground link

# Options (if any):

Input:

type MakeUpdater = (ids: string[]) => ((proxy: any, response: any) => any);

Output:

type MakeUpdater = (ids: string[]) => (proxy: any, response: any) => any;

Expected behavior: input is not modified; parentheses are preserved around second lambda function to improve readability

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
j-f1commented, Feb 11, 2019

IMO the input is perfectly readable. It describes a function that returns a function that returns a value.

3reactions
hawkrivescommented, Feb 5, 2019

Isn’t that the same result type, though? Does this break code or is it a stylistic request?

Read more comments on GitHub >

github_iconTop Results From Across the Web

f# - More instructions in lambda function body - Stack Overflow
F# is whitespace- and indentation-sensitive. Nesting of blocks of code is determined by how they are indented to the right.
Read more >
Lambdas, Nested Functions, and Blocks, oh my! | The Pasture
What's in a Name? The rest of the syntax is easy to follow: there's an opening parentheses to start the usual argument list,...
Read more >
Overusing lambda expressions in Python - Trey Hunner
Python's lambda expressions allow a function to be created and passed around (often into another function) all in one line of code.
Read more >
Lambda Expressions and Functional Interfaces: Tips and Best ...
Lambda syntax only requires parentheses around more than one parameter, or when there is no parameter at all. That's why it's safe to...
Read more >
Python Lambda Function - Learn By Example
Learn to create a Lambda function in Python, pass multiple arguments, return multiple values, combine with map() and filter(), sort iterables, nested ......
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