Skip to content

Bug: ast-spec should allow AwaitExpression and NewExpression in LeftHandSideExpression #6239

Closed as not planned
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Relevant Package

ast-spec

Playground Link

https://typescript-eslint.io/play/#ts=4.9.3&sourceType=module&showAST=es&code=MYewdgzgLgBApgDwIYFsAOAbOMC8MDeAvjEhCWAJ4DcAUDQBRIDuSAlrIqpnAJQB0aAE4g0tRi3YwwcJvGTos-ISNo1EaEINj4YhKkA&eslintrc=N4KABGBEBOCuA2BTAzpAXGYBfEWg&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkeAhpgObp4VTolHoAebANOBqQSeTMmh4AcgFdUqAMIALdNADWZSmJnohAXxB6gA

Repro Code

const example = {} as any;

(await example).prop;
(await new example).prop;

ESLint Config

No response

tsconfig

No response

Expected Result

In the type system: the object property in the TSESTree.MemberExpression type is a TSESTree.LeftHandSideExpression.

In the playground's tree: the object property on the first MemberExpression is an AwaitExpression. The second MemberExpression's object property is a NewExpression.

TSESTree.LeftHandSideExpression should therefore allow TSESTree.AwaitExpression and TSESTree.NewExpression.

Actual Result

The TSESTree.LeftHandSideExpression union does not include TSESTree.AwaitExpression or TSESTree.NewExpression.

Additional Info

Originally spotted in https://github.com/typescript-eslint/typescript-eslint/pull/6028/files#r1032600861

Versions

package version
@typescript-eslint/ast-spec 5.46.1
@typescript-eslint/types 5.46.1
@typescript-eslint/typescript-estree 5.46.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions