Issue 1:
Bug Report

Current Behavior

Babel can't parse the following syntax. Works perfectly when using pure typescript.

Input Code

const importRowsToElasticDB = async <T>(rows: T[], indexName: string, typeName: string): Promise<any> => {
^
Unexpected token, expected ";"

at Object.raise (/Users/congy/Desktop/projects/ua-app-backend/node_modules/@babel/parser/lib/index.js:3831:17)
at Object.unexpected (/Users/congy/Desktop/projects/ua-app-backend/node_modules/@babel/parser/lib/index.js:5143:16)
at Object.semicolon (/Users/congy/Desktop/projects/ua-app-backend/node_modules/@babel/parser/lib/index.js:5131:40)
at Object.parseVarStatement (/Users/congy/Desktop/projects/ua-app-backend/node_modules/@babel/parser/lib/index.js:7715:10)
at Object.parseStatementContent (/Users/congy/Desktop/projects/ua-app-backend/node_modules/@babel/parser/lib/index.js:7310:21)
at Object.parseStatementContent (/Users/congy/Desktop/projects/ua-app-backend/node_modules/@babel/parser/lib/index.js:10130:18)
at Object.parseStatement (/Users/congy/Desktop/projects/ua-app-backend/node_modules/@babel/parser/lib/index.js:7243:17)
at Object.parseBlockOrModuleBlockBody (/Users/congy/Desktop/projects/ua-app-backend/node_modules/@babel/parser/lib/index.js:7810:25)
at Object.parseBlockBody (/Users/congy/Desktop/projects/ua-app-backend/node_modules/@babel/parser/lib/index.js:7797:10)
at Object.parseTopLevel (/Users/congy/Desktop/projects/ua-app-backend/node_modules/@babel/parser/lib/index.js:7181:10)
at Object.parse (/Users/congy/Desktop/projects/ua-app-backend/node_modules/@babel/parser/lib/index.js:8660:17)
at parse (/Users/congy/Desktop/projects/ua-app-backend/node_modules/@babel/parser/lib/index.js:10660:38)
at parser (/Users/congy/Desktop/projects/ua-app-backend/node_modules/@babel/core/lib/transformation/normalize-file.js:170:34)
at normalizeFile (/Users/congy/Desktop/projects/ua-app-backend/node_modules/@babel/core/lib/transformation/normalize-file.js:138:11)
at runSync (/Users/congy/Desktop/projects/ua-app-backend/node_modules/@babel/core/lib/transformation/index.js:44:43)
at runAsync (/Users/congy/Desktop/projects/ua-app-backend/node_modules/@babel/core/lib/transformation/index.js:35:14)
at process.nextTick (/Users/congy/Desktop/projects/ua-app-backend/node_modules/@babel/core/lib/transform.js:34:34)
at process._tickCallback (internal/process/next_tick.js:61:11)

Expected behavior/code

babel-typescript correctly parses this syntax

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

{
"presets": [
"@babel/preset-typescript",
["@babel/preset-env", {
"targets": { "node": "8.10" },
"useBuiltIns": "usage",
"modules": false,
"loose": true
}]
],
"plugins": [
"babel-plugin-node-source-map-support",
"@babel/plugin-proposal-optional-catch-binding"
]
}

Environment

Babel version(s): @babel/core@7.3.4, @babel/preset-typescript@7.3.3

Node/npm version: Node 11/yarn 1.13

OS: e.g. OSX 10.13.6

Monorepo: no

How you are using Babel: via webpack (latest v4)

typescript: 3.3.3

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