Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow function types in type params within arrow return types (#8954)
- Loading branch information
1 parent
e85faec
commit cd81b07
Showing
5 changed files
with
439 additions
and
0 deletions.
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
1 change: 1 addition & 0 deletions
1
packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_14/input.js
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 @@ | ||
type T = Array<(string) => number> |
183 changes: 183 additions & 0 deletions
183
...es/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_14/output.json
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,183 @@ | ||
{ | ||
"type": "File", | ||
"start": 0, | ||
"end": 34, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 34 | ||
} | ||
}, | ||
"program": { | ||
"type": "Program", | ||
"start": 0, | ||
"end": 34, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 34 | ||
} | ||
}, | ||
"sourceType": "module", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "TypeAlias", | ||
"start": 0, | ||
"end": 34, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 34 | ||
} | ||
}, | ||
"id": { | ||
"type": "Identifier", | ||
"start": 5, | ||
"end": 6, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 5 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 6 | ||
}, | ||
"identifierName": "T" | ||
}, | ||
"name": "T" | ||
}, | ||
"typeParameters": null, | ||
"right": { | ||
"type": "GenericTypeAnnotation", | ||
"start": 9, | ||
"end": 34, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 9 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 34 | ||
} | ||
}, | ||
"typeParameters": { | ||
"type": "TypeParameterInstantiation", | ||
"start": 14, | ||
"end": 34, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 14 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 34 | ||
} | ||
}, | ||
"params": [ | ||
{ | ||
"type": "FunctionTypeAnnotation", | ||
"start": 15, | ||
"end": 33, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 15 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 33 | ||
} | ||
}, | ||
"params": [ | ||
{ | ||
"type": "FunctionTypeParam", | ||
"start": 16, | ||
"end": 22, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 16 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 22 | ||
} | ||
}, | ||
"name": null, | ||
"optional": false, | ||
"typeAnnotation": { | ||
"type": "StringTypeAnnotation", | ||
"start": 16, | ||
"end": 22, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 16 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 22 | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"rest": null, | ||
"returnType": { | ||
"type": "NumberTypeAnnotation", | ||
"start": 27, | ||
"end": 33, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 27 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 33 | ||
} | ||
} | ||
}, | ||
"typeParameters": null | ||
} | ||
] | ||
}, | ||
"id": { | ||
"type": "Identifier", | ||
"start": 9, | ||
"end": 14, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 9 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 14 | ||
}, | ||
"identifierName": "Array" | ||
}, | ||
"name": "Array" | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-parser/test/fixtures/flow/anonymous-function-no-parens-types/good_15/input.js
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 @@ | ||
let x = (): Array<(string) => number> => [] |
Oops, something went wrong.