Skip to content

[Typescript] Regression: wrong formatting on type assertion #5684

@yuriykuzin

Description

@yuriykuzin

I guess it was resolved, but now come back.
Similar issue marked as resolved: #4171

Prettier 1.15.3
Playground link

--parser typescript

Input:

const isAnySuccessfulAttempt$: Observable<boolean> = this._quizService.isAnySuccessfulAttempt$().pipe(
  tap((isAnySuccessfulAttempt: boolean) => {
    this.isAnySuccessfulAttempt = isAnySuccessfulAttempt;
  }),
);

Output:

const isAnySuccessfulAttempt$: Observable<
  boolean
> = this._quizService.isAnySuccessfulAttempt$().pipe(
  tap((isAnySuccessfulAttempt: boolean) => {
    this.isAnySuccessfulAttempt = isAnySuccessfulAttempt;
  })
);

Expected behavior:

const isAnySuccessfulAttempt$: Observable<boolean> = 
  this._quizService.isAnySuccessfulAttempt$().pipe(
    tap((isAnySuccessfulAttempt: boolean) => {
      this.isAnySuccessfulAttempt = isAnySuccessfulAttempt;
    })
  );

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions