Issue 1:
Bug Report

Current Behavior

I have an anonymous generic async arrow function which contain Prmose.all, it work fine when try to compile using tsc but fail using babel. Probably related to #9086 . I try to create REPL bellow.

Input Code

REPL

It need plugin tranform typescript

const a = async <T>(data: T): Promise<T> => Promise.resolve(data)
const b = async <T>(data: T[]): Promise<T[]> => {
const x = await Promise.all(
data.map(x => Promise.resolve(x));
)
return x
}
export const c = async <T>(data: T): Promise<T> => Promise.resolve(data)

it will compile if I comment c function

Expected behavior/code

It works with tsc so it should work with babel too.

Babel Configuration (.babelrc, package.json, cli command)

{
{
"presets": [
["@babel/env", {
"targets": {
"node": true
}
}],
"@babel/typescript"
],
"plugins": [
["module-resolver", {
"root": ["./src"],
"alias": {
"@": "./src"
},
"extensions": [".js", ".ts", ".tsx"]
}],
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread"
]
}
}

Environment

Babel version(s): v7.3.4

Node/npm version: node v10.15.1 / npm 6.4.1

OS: v10.15.1

Monorepo: yes

How you are using Babel: cli

Possible Solution

Probably related to #9086

this is my first issue report in my history, i'm sorry if i made any mistake.

Issue 2:
Bug Report

Current Behavior

In the current @babel/parser version 7.3.3, a class property that defines an async arrow function with generics breaks the parser.

SyntaxError: boost/packages/core/src/Executor.ts: Unexpected token, expected ";" (85:52)

83 | * Execute a task with the provided value.
84 | */
> 85 | executeTask = async <T>(task: Task<Ctx>, value?: T): Promise<any> => {
| ^
86 | const { console: cli } = this.tool;
87 | let result = null;
88 |

at Object.raise (node_modules/@babel/parser/lib/index.js:3831:17)

If you remove the <T> generics or the async/await, the parser works.

Input Code

executeTask = async <T>(task: Task<Ctx>, value?: T): Promise<any> => {
const { console: cli } = this.tool;
let result = null;

cli.emit('task', [task, value, this.parallel]);

try {
result = await task.run(this.context, value);

if (task.isSkipped()) {
cli.emit('task.skip', [task, value, this.parallel]);
} else {
cli.emit('task.pass', [task, result, this.parallel]);
}
} catch (error) {
cli.emit('task.fail', [task, error, this.parallel]);

throw error;
}

return result;
};

Expected behavior/code

It parses. This worked in the previous version.

Babel Configuration (.babelrc, package.json, cli command)

module.exports = {
"babelrc": false,
"comments": false,
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-optional-catch-binding",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-syntax-dynamic-import",
[
"babel-plugin-transform-dev",
{
"evaluate": false
}
]
],
"presets": [
[
"@babel/preset-env",
{
"modules": "commonjs",
"shippedProposals": true,
"targets": {
"node": "10.9.0"
},
"useBuiltIns": false
}
],
"@babel/preset-typescript"
]
};

Environment

Babel version(s): 7.3.3

Node/npm version: 10.14.1/6.5.0

OS: OSX 10.14.3

Monorepo: yes

How you are using Babel: cli