dprint/dprint-plugin-typescript

Don't trailing generic comma when format tsx file when `trailingComma: never`

NWYLZW opened this issue · 3 comments

Describe the bug

dprint-plugin-typescript version: 0.90.3

Input Code

[].filter(<T,>() => false)

Expected Output

[].filter(<T,>() => false)

Actual Output

[].filter(<T>() => false)

playground

image

I can't reproduce this. Are you formatting in a tsx file?

It gives your expected output in the playground when selecting .tsx:

image

image

Yes, I selected the .tsx, but I had configured trailingCommon as never in playground link.

According to the semantics of tsx, the comma here has a special purpose and should not be removed by dprint. However, dprint removed it.

I think this might require special handling logic here, but to be honest, it feels a bit complicated.

Yes, I selected the .tsx, but I had configured trailingCommon as never

That's the key piece of missing information.