John Sun
John Sun

Reputation: 13

How to not insert a space at both side of '<' and '>'?

I get a formatting mistake that when I just have formatted my ts code with Beautify Extension in VS Code, any types Array<T> and Map<T1, T2> will be formatted as Array < T > and Map < T1, T2 >. So I have to delete the space manually.

Does anyone know how to resolve this?

Before formatting:

Before formatting

After formatting:

After formatting

Upvotes: 1

Views: 88

Answers (1)

superhawk610
superhawk610

Reputation: 2653

js-beautify doesn't officially support TypeScript (see this open issue tracking the extra whitespace around generic type parameters). You'll probably have more luck in general with a formatter that officially supports TS, such as prettier.

Upvotes: 1

Related Questions