Skip to content

Function call with type parameter causes "unknown TSTypeCastExpression node" error #12141

@woongsikchoi

Description

@woongsikchoi

Bug Report

Current behavior
If function call has a type parameter and argument expression has :, the following error occurs:

unknown node of type "TSTypeCastExpression" with constructor "e"

However, if I remove the type parameter, the following syntax error occurs:

Did not expect a type annotation here.

Input Code

func<A>(x: any);

Expected behavior
The syntax error should occur regardless of the type parameter.

Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)

  • Filename: babel.config.js
{
  "presets": ["@babel/preset-typescript"]
}

Environment

  System:
    OS: Linux 4.4 Ubuntu 16.04.7 LTS (Xenial Xerus)
  Binaries:
    Node: 10.15.1 - ~/local/lib/node-v10.15.1-linux-x64/bin/node
    Yarn: 1.22.4 - ~/local/lib/node-v10.15.1-linux-x64/bin/yarn
    npm: 6.9.0 - ~/local/lib/node-v10.15.1-linux-x64/bin/npm
  npmPackages:
    @babel/cli: ^7.11.6 => 7.11.6 
    @babel/core: ^7.11.6 => 7.11.6 
    @babel/polyfill: ^7.11.5 => 7.11.5 
    @babel/preset-env: ^7.11.5 => 7.11.5 
    @babel/preset-typescript: ^7.10.4 => 7.10.4 

Metadata

Metadata

Labels

outdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions