#20165·prettier

Two comments before an arrow's `=>` print a line break before `=>`, which doesn't parse

Author: leonidazCreated Sep 28, 2026Updated Sep 28, 2026

Prettier 3.9.9 Playground link

bash
--parser typescript

Input:

typescript
const f = (a) /* b */ /* c */ => a;

Output:

typescript
const f = (a) /* b */
/* c */ => a;

Second Output:

typescript
const f = (a /* b */) => /* c */ a;

Expected output:

typescript
const f = (a) /* b */ /* c */ => a;

Why?

A line break before => is a syntax error (TS1200: Line terminator not permitted before arrow). With one comment ((a) /* b */ => a) the output is stable. async (a) /* b */ /* c */ => a does the same.

Related: #11100 (fixed by #17421), the single-comment case.

Also reproduces on main (88d8e96).