Fix parenthesis for optional function as return type (#11004)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
This commit is contained in:
1 parent
cc90434c80
commit
599bad1415
5 files changed
+75
-2
No files matched your search
@@ -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;
|
||||
};
|
||||
```
|
||||
Reference in new issue
Block a user