#20167·prettier

Parentheses dropped around an instantiation expression before `!` and in `export default`

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

Prettier 3.9.9

Example 1

Playground link

bash
--parser typescript

Input:

typescript
const a = (make<T>)!;

Output:

typescript
const a = make<T>!;

Second format (of the output above) fails:

Expression expected. (1:19)

Example 2

Playground link

bash
--parser typescript

Input:

typescript
export default (class {})<string>;

Output:

typescript
export default class {}<string>;

Second format (of the output above) fails:

Expression expected. (1:32)

Expected output

typescript
const a = (make<T>)!;

export default (class {})<string>;

Why?

Without the parentheses the output doesn't parse. #20027 (on main) added parentheses for the callee, new, tag and superclass positions, but these two still lose them on main.

Also reproduces on main (88d8e96).