-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Comments in the single item union type are placed incorrectly in the TSTypeAliasDeclaration #18834
Copy link
Copy link
Open
Labels
area:commentsIssues with how Prettier prints commentsIssues with how Prettier prints commentslang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)Issues affecting TypeScript-specific constructs (not general JS issues)
Description
Prettier 3.8.1
Playground link
--parser babel-tstype A1 =
/* 1 */ | /* 2 */ (
/* 3 */ | /* 4 */ {
key: string;
}
);Output:
type A1 /* 2 */ = /* 1 */ /* 3 */ /* 4 */ {
key: string;
};Expected output:
type A1 = /* 1 */ /* 2 */ /* 3 */ /* 4 */ {
key: string;
};Why?
Comment /* 2 */ moves from after = to before =. This changes the comment from annotating the type value to annotating the type name. The reordering of comments seems arbitrary.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:commentsIssues with how Prettier prints commentsIssues with how Prettier prints commentslang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)Issues affecting TypeScript-specific constructs (not general JS issues)