-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
outdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
Annotating a function type in Flowtype with a default parameter (which looks like ?Type) seems to cause a parsing error in the current version of Babel, ^6.21. This could be a regression of #2493.
Input Code
const fn: ( Object, ?Object ) => void = ( o1, o2 ) => o1Babel Configuration (.babelrc, package.json, cli command)
NOTE: Fails on REPL too so probably irrelevant, see link above. Included anyway just in case:
{
"presets": [
"es2015",
"react"
],
"plugins": [
"react-hot-loader/babel",
"ramda",
["babel-root-slash-import", {
"rootPathSuffix": "src"
}],
["extensible-destructuring", {
"mode": "optout",
"impl": "immutable"
}]
],
"env": {
"test": {
"plugins": [
"istanbul"
]
}
}
}Expected Behavior
The code parses successfully.
Current Behavior
A parsing error occurs at the default parameter Flow annotation:
Unexpected token, expected ) (1:20)
> 1 | const fn: ( Object, ?Object ) => void = ( o1, o2 ) => o1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
outdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue