Skip to content

Commit

Permalink
disable optimization from #6229 for calls with type arguments (#6791)
Browse files Browse the repository at this point in the history
  • Loading branch information
thorn0 authored and lydell committed Nov 3, 2019
1 parent 677b46d commit 12ba997
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/language-js/printer-estree.js
Expand Up @@ -4024,7 +4024,9 @@ function printArgumentsList(path, options, print) {
somePrintedArgumentsWillBreak ? breakParent : "",
conditionalGroup(
[
!somePrintedArgumentsWillBreak
!somePrintedArgumentsWillBreak &&
!node.typeArguments &&
!node.typeParameters
? simpleConcat
: ifBreak(allArgsBrokenOut(), simpleConcat),
shouldGroupFirst
Expand Down
20 changes: 20 additions & 0 deletions tests/break-calls/__snapshots__/jsfmt.spec.js.snap
Expand Up @@ -231,3 +231,23 @@ function MyComponent(props) {
================================================================================
`;

exports[`type_args.js 1`] = `
====================================options=====================================
parsers: ["flow", "typescript"]
printWidth: 80
| printWidth
=====================================input======================================
const response = something.$http.get<ThingamabobService.DetailsData>(
\`api/foo.ashx/foo-details/\${myId}\`,
{ cache: quux.httpCache, timeout }
);
=====================================output=====================================
const response = something.$http.get<ThingamabobService.DetailsData>(
\`api/foo.ashx/foo-details/\${myId}\`,
{ cache: quux.httpCache, timeout }
);
================================================================================
`;
4 changes: 4 additions & 0 deletions tests/break-calls/type_args.js
@@ -0,0 +1,4 @@
const response = something.$http.get<ThingamabobService.DetailsData>(
`api/foo.ashx/foo-details/${myId}`,
{ cache: quux.httpCache, timeout }
);

0 comments on commit 12ba997

Please sign in to comment.