Line comment between a superclass and its type arguments is unstable
Author: leonidazCreated Sep 28, 2026Updated Sep 28, 2026
Prettier 3.9.9
Example 1
--parser typescriptInput:
class A extends B
// c
<T> {}Output:
class A extends B// c
<T> {}Second Output:
class A
extends B<T> {} // cExample 2
--parser typescriptInput:
class A extends B // c
<T> {}Output:
class A
extends B<T> {} // cSecond Output:
class A extends B<T> {} // cExpected output
class A extends B<T> {} // c
class A extends B<T> {} // cWhy?
The first format prints B// c (the comment glued to B) or breaks the heading, and the second format prints a different layout. Still reproduces on main after #19897.
Also reproduces on main (88d8e96).
Source: prettier/prettier