22 lines
620 B
Markdown
22 lines
620 B
Markdown
#### Support the "decorated function" pattern (#10714 by @thorn0)
|
|
|
|
In this case the developer is usually willing to sacrifice the readability of the arrow function's signature to get less indentation in its body. Prettier now recognizes this pattern and keeps the arrow function hugged even if the signature breaks.
|
|
|
|
<!-- prettier-ignore -->
|
|
```ts
|
|
// Prettier stable
|
|
const Counter = decorator("my-counter")(
|
|
(props: { initialCount?: number; label?: string }) => {
|
|
// ...
|
|
}
|
|
);
|
|
|
|
// Prettier main
|
|
const Counter = decorator("my-counter")((props: {
|
|
initialCount?: number;
|
|
label?: string;
|
|
}) => {
|
|
// ...
|
|
});
|
|
```
|