Prettier 3.8.1
Playground link
Input:
https://github.com/prettier/prettier/blob/812a4d0071270f61a7aa549d625b618be7e09d71/tests/format/typescript/union/single-type/single-type.ts#L1-L7
type 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.
Prettier 3.8.1
Playground link
Input:
https://github.com/prettier/prettier/blob/812a4d0071270f61a7aa549d625b618be7e09d71/tests/format/typescript/union/single-type/single-type.ts#L1-L7
Output:
Expected output:
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.