angular/clang-format

Incorrect format for a type with template followed by an equals sign.

Goodwine opened this issue · 1 comments

When a template thingy is followed by an equals sign, clang-format thinks it's a less-than-or-equal-to operator and formats things weird.

This

class Something<T> {};

let a: Something<string>=new Something<string>();
let b: Something<string> =new Something<string>();

becomes this

class Something<T> {};

let a: Something < string >= new Something<string>();
let b: Something<string> = new Something<string>();

Known issue. I'm actually quite surprised this is valid TS to begin with, unparsing the >= into separate tokens is tricky. This is too hard to fix for us, as we cannot know when to split >= before actual parsing, which is way too late in the tool stage. My suggestion is not to write code like that :-)