Fix parenthesis for optional function as return type (#11004)

Co-authored-by: fisker Cheung <lionkay@gmail.com>
This commit is contained in:
Christopher Chedeauandfisker Cheung authored and GitHub committed 2026-01-25 05:03:35 +08:00
1 parent cc90434c80
commit 599bad1415
5 files changed
+75 -2

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
#### Fix parenthesis for optional function as return type (#11004 by @vjeux, @fisker)
<!-- prettier-ignore -->
```jsx
// Input
const fun = (a: number): (?(string => string)) => {
return a > 0 ? s => `${s}: ${a}` : null;
};
// Prettier stable
const fun = (a: number): ?(string) => string => {
return a > 0 ? (s) => `${s}: ${a}` : null;
};
// Prettier main
const fun = (a: number): (?(string) => string) => {
return a > 0 ? (s) => `${s}: ${a}` : null;
};
```