Bug Report
Current Behavior
With @babel/preset-flow, when a variable is named async, the compiler gets confused within a conditional operator and emits a syntax error.
Input Code
// @flow
import * as async from 'async';
true ? async.waterfall() : null;
/repl: Unexpected token, expected "=>" (5:31)
3 | import * as async from 'async';
4 |
> 5 | true ? async.waterfall() : null;
| ^
6 |
Expected behavior/code
It's expected that async would be treated as a normal variable; it's seemingly only within this particular type of expression that things act oddly. Also, the flow compiler when not going through babel does not seem to have this issue.
Note that working around this is easy enough; I'm just reporting the bug to be a good citizen.
Babel Configuration (.babelrc, package.json, cli command)
{
"presets": [
["@babel/preset-env", {
"targets": {
"node": "10.15"
}
}],
"@babel/preset-flow"
],
"plugins": ["add-module-exports"]
}
Environment
- Babel version(s): 7.5.5 (@babel/core 7.5.5)
- Node version: v10.15.3
- npm version: 6.10.3
- OS: macOS 10.14.6
- Monorepo: no
- How you are using Babel:
cli and register
Bug Report
Current Behavior
With
@babel/preset-flow, when a variable is namedasync, the compiler gets confused within a conditional operator and emits a syntax error.Input Code
Expected behavior/code
It's expected that
asyncwould be treated as a normal variable; it's seemingly only within this particular type of expression that things act oddly. Also, the flow compiler when not going through babel does not seem to have this issue.Note that working around this is easy enough; I'm just reporting the bug to be a good citizen.
Babel Configuration (.babelrc, package.json, cli command)
{ "presets": [ ["@babel/preset-env", { "targets": { "node": "10.15" } }], "@babel/preset-flow" ], "plugins": ["add-module-exports"] }Environment
cliandregister