Tracking follow-up to #33402
When synthetic object literal type nodes are printed on a single line, they come out like
type X = { a: string; b: string; };
While working on semicolon formatting features, I briefly had the formatter remove the semicolon after b: string;. The result was well-received but I ultimately decided the logic didn’t belong in the formatter; if this was going to be the canonical formatting of single-line object type literals, they should simply come out of the emitter that way.
Why semicolons? Why not just
type X = { a: string, b: string };
I only usually use semicolons in interfaces.
This is also how I write single-line object types. Honestly I’m a little worried that _any_ change I make here will incite an angry mob composed of people with a particular lint rule. So I guess the answer to your question is “fear of public ridicule,” or more seriously, a preference not to shake things up for everyone without a good reason. Which is why I’m not totally confident that I will make this change at all.
Personally I'd prefer comma.
Prettier users will get their ; for free*
type X = { a: string, b: string };
// emitted as
type X = { a: string; b: string };
* for better or worse (definitely worse, because it will replace my ,)
Most helpful comment
Why semicolons? Why not just
I only usually use semicolons in interfaces.