Own-line block comment after a type annotation's `:` or after `...` is unstable
Author: leonidazCreated Sep 28, 2026Updated Sep 28, 2026
Prettier 3.9.9
Example 1
--parser typescriptInput:
let a:
/* c */
T;Output:
let a: /* c */
T;Second Output:
let a: /* c */ T;Example 2
--parser typescriptInput:
f(...
/* c */
a);Output:
f(
.../* c */
a,
);Second Output:
f(.../* c */ a);Expected output
let a: /* c */ T;
f(.../* c */ a);Why?
The first format prints T on the next line without indentation, and breaks the call after .../* c */. The second format joins the lines.
Related: #11777 (a multi-line comment after a type).
Also reproduces on main (88d8e96).
Source: prettier/prettier