-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
typescript preset: incompatible with += operator inside arrow functions, nested in ternary #11038
Copy link
Copy link
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 issuepkg: parser
Description
Bug Report
- I would like to work on a fix!
I have close to zero experience with Babel's internals though. I would not be offended, if you think you can fix it yourself quicklier.
Current Behavior
The typescript preset is incompatible with d3-array/cumsum.js. The issue seems to only occur for arrow functions using the += operator, nested inside a ternary. When typescript is disabled, the code compiled without any issues.
Input Code
0 ? v => (sum += v) : v => 0;/repl.ts: Only '=' operator can be used for specifying default value. (1:13)
1 | 0 ? v => (sum += v) : v => 0;
Expected behavior/code
Babel should compile the above code with typescript enabled.
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 issuepkg: parser