Skip to content

Optional chaining: a?.()() is parsed as (a?.())() #8159

@thorn0

Description

@thorn0

Flow version: flow-parser 0.108.0

Expected behavior

In a?.()(), the outer call expression should be of type OptionalCallExpression.

In a?.().b, the member expression should be of type OptionalMemberExpression.

Actual behavior

The outer call expression is of type CallExpression as if the inner call expression were in parens: (a?.())().

The member expression is of type MemberExpression as if the inner call expression were in parens: (a?.()).b.

  • Link to Try-Flow or Github repo:

https://astexplorer.net/#/gist/cb552979d476b074013786d94198bebd/55ca44317e6158fadadf87806fe29d23e5d3e170

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions