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.

Generic type breaks line in none expected way

See original GitHub issue

Prettier 1.15.2 Playground link

--parser typescript
--print-width 100
--single-quote
--use-tabs

Input:

fetchPaymentsResult$ = (this.actions$.ofType(FETCH_PAYMENT_OVERVIEW) as Observable<Action>).switchMap(() =>
    this.paymentsService
      .fetch()
  );

Output:

fetchPaymentsResult$ = (this.actions$.ofType(FETCH_PAYMENT_OVERVIEW) as Observable<
	Action
>).switchMap(() => this.paymentsService.fetch());

Expected behavior: This Observable<Action> should not be broken apart. An acceptable output would be

fetchPaymentsResult$ = (this.actions$.ofType(FETCH_PAYMENT_OVERVIEW) as 
  Observable<Action>).switchMap(() => this.paymentsService.fetch());

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:14
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
j-f1commented, Jul 11, 2019

If someone created a PR to fix this, would you accept it?

Probably, as long as it includes tests and doesn’t add an option 😃

2reactions
BernhardFuchscommented, Nov 26, 2018

Not sure. #5399 happens when chaining, this one is when assigning a type.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generic method is not type-sensitive - Stack Overflow
I am learning the Generics and tried to alter one of the examples. I expected the code will not compile even with the...
Read more >
Generic Types - Learning the Java Language
A generic type is a generic class or interface that is parameterized over types. The following Box class will be modified to demonstrate...
Read more >
io — Core tools for working with streams — Python 3.11.1 ...
The newline argument works like that of TextIOWrapper , except that when writing output to the stream, if newline is None , newlines...
Read more >
4.1. Generic Types - Java in a Nutshell, 5th Edition [Book]
A generic type is defined using one or more type variables and has one or more ... The add( ) method is redefined...
Read more >
C++ Core Guidelines - GitHub Pages
We do not expect you to memorize all the rules before trying to write code. One way of thinking about these guidelines is...
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