Bug Report
- [~] I would like to work on a fix!
Current behavior
Parse error when an explicit type parameter is a generic arrow function
Input Code
f<<T>(value: T) => void>(g);
Expected behavior
The type parameter should be stripped from the code:
Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
- Filename:
babel.config.js
{
"presets": [
["@babel/preset-env", { "targets": { "node": "current" } }],
"@babel/typescript"
],
"plugins": [
"@babel/plugin-syntax-class-properties"
]
}
Environment
- Babel version(s): v7
- Node/npm version: Node 13.8.0/npm 6.13.6
- OS:macOS 10.15.5
- Monorepo: yes
- How you are using Babel: cli
Possible Solution
Note that these two examples both parse correctly:
f< <T>(value: T) => void>(g); // Note the space between the two "<"
f<U, <T>(value: T) => void>(g);
My guess is that the parser thinks it's encountered a << operator. I think C++ also used to have this problem in its parser 😅.
Additional context
TypeScript playground
Bug Report
Current behavior
Parse error when an explicit type parameter is a generic arrow function
Input Code
Expected behavior
The type parameter should be stripped from the code:
Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
babel.config.jsEnvironment
Possible Solution
Note that these two examples both parse correctly:
My guess is that the parser thinks it's encountered a
<<operator. I think C++ also used to have this problem in its parser 😅.Additional context
TypeScript playground