Skip to content

[Bug]: Failed to parse optional chain call with generic #13400

@wKich

Description

@wKich

💻

  • Would you like to work on a fix?

How are you using Babel?

@babel/register or @babel/node

Input code

apply?.('foo') // Works
apply<string>('foo') // Works
apply?.<string>('foo') // Failed to parse, but syntax is valid
// Check the ts playground https://www.typescriptlang.org/play?#code/IYBxBsE8H4DoB4DOAXATgSwHYHMB8AKAcgDMB7UwgSiA

Configuration file name

No response

Configuration

See the REPL link below

Current and expected behavior

Parse without error

Environment

https://babeljs.io/repl#?browsers=defaults%2C%20not%20ie%2011%2C%20not%20ie_mob%2011&build=&builtIns=false&corejs=3.6&spec=false&loose=false&code_lz=IYBxBsE8H4DoAoDkAzA9qxBKABAel9gOqoBOA1gM4BQoEkAPBQC4kCWAdgOYB8SaGOfEVKUaYKHEYsOPPuix4CAMWCtwAUwAmQA&debug=false&forceAllTransforms=false&shippedProposals=false&circleciRepo=&evaluate=false&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=env%2Cstage-0%2Cstage-1%2Cstage-2%2Cstage-3%2Ctypescript&prettier=false&targets=&version=7.14.4&externalPlugins=

Possible solution

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

area: typescriptoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions