You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functionfoor(foo: any): foo.bar.baz|null{// This is a comment for the first code block.constgraph=newGraph(true)constentryModules=newSet()// This is another commentconstfoo='foo'}
Better
functionfoor(foo: any): foo.bar.baz|null{// This is a comment for the first code block.constgraph=newGraph(true)constentryModules=newSet()}
Workaround
functionfoor(foo: any): foo.bar.baz|null{//// This is a comment for the first code block.constgraph=newGraph(true)constentryModules=newSet()//}
Discussion
The only rationale in all discussions is as follows:
vjeux: What I found is that the important piece is not the actual decision about having space or not in this context, but the fact that it is consistently applied. #2599 (comment)
Current Judgement
vjeux: I'm sorry but we're not going to support this style inside of prettier :( #2352 (comment)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
With the increasing prevalence of TypeScript, I think maybe it's worth revisiting.
I find that the readability of a function is reduced any time a TypeScript return type is specified, like as follows below.
It would be nice to have an option.
I know it probably won't happen, but good to have a summary of the discussion here for longevity if I ever forget why again.
TypeScript typed return
Current
Better
Maybe Better
Moving the return type to a type alias on a separate line helps reduce the noise.
First comment
Also when the first line is a comment:
Current
Better
Workaround
Discussion
The only rationale in all discussions is as follows:
Current Judgement
Related
#3501
#2352
#2599
#879
Beta Was this translation helpful? Give feedback.
All reactions