-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Flow: fix function type param (#8365)
- Loading branch information
Showing
5 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#### Fix function type param contains nullable param ([#8365](https://github.com/prettier/prettier/pull/8365) by [@fisker](https://github.com/fisker)) | ||
|
||
<!-- prettier-ignore --> | ||
```flow | ||
// Input | ||
let f: <A>( | ||
((?A) => B), | ||
) => B; | ||
// Prettier stable | ||
let f: <A>((?A) => B) => B; | ||
// Prettier stable (Second format) | ||
SyntaxError: Unexpected token (1:12) | ||
> 1 | let f: <A>((?A) => B) => B; | ||
// Prettier master | ||
let f: <A>(((?A) => B)) => B; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
tests/flow/function-type-param/__snapshots__/jsfmt.spec.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`issue-5283.js format 1`] = ` | ||
====================================options===================================== | ||
parsers: ["flow", "babel"] | ||
printWidth: 80 | ||
| printWidth | ||
=====================================input====================================== | ||
let f: <A>(( | ||
(?A) => B | ||
)) => B; | ||
export const testFunctionOnOptionsAsArgument: <T1,a>(?a, ((?a) => T1)) => T1 = function _(Arg1, Arg2) { const result = TypesBS.testFunctionOnOptionsAsArgument((Arg1 == null ? undefined : Arg1), Arg2); return result }; | ||
=====================================output===================================== | ||
let f: <A>(((?A) => B)) => B; | ||
export const testFunctionOnOptionsAsArgument: <T1, a>( | ||
?a, | ||
((?a) => T1) | ||
) => T1 = function _(Arg1, Arg2) { | ||
const result = TypesBS.testFunctionOnOptionsAsArgument( | ||
Arg1 == null ? undefined : Arg1, | ||
Arg2 | ||
); | ||
return result; | ||
}; | ||
================================================================================ | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
let f: <A>(( | ||
(?A) => B | ||
)) => B; | ||
|
||
|
||
export const testFunctionOnOptionsAsArgument: <T1,a>(?a, ((?a) => T1)) => T1 = function _(Arg1, Arg2) { const result = TypesBS.testFunctionOnOptionsAsArgument((Arg1 == null ? undefined : Arg1), Arg2); return result }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
run_spec(__dirname, ["flow", "babel"]); |