Files
test-repo/changelog_unreleased/javascript/12268.md
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.1 KiB
Markdown
Raw Normal View History

#### Improve printing of comments in type aliases in Flow & TS (#12268 by @duailibe)
For Flow, the comments will now be more aligned to how we print comments in assignments where the right-hand side is an object expression:
<!-- prettier-ignore -->
```js
// Input
type Props = // comment explaining the props
{
isPlaying: boolean
};
// Prettier stable
// comment explaining the props
type Props = {
isPlaying: boolean,
};
// Prettier main
type Props =
// comment explaining the props
{
isPlaying: boolean,
};
```
2022-03-16 13:25:48 +09:00
This change also fixes an issue where a similarly-placed comment in TypeScript would be moved again after a second formatting operation:
<!-- prettier-ignore -->
```ts
// Input
type Props = // comment explaining the props
{
isPlaying: boolean
};
// Prettier stable
type Props = { // comment explaining the props
isPlaying: boolean;
};
// Prettier stable (2nd format)
type Props = {
// comment explaining the props
isPlaying: boolean;
};
// Prettier main
type Props =
// comment explaining the props
{
isPlaying: boolean,
};
```