Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4 tasks done
JoshuaKGoldberg opened this issue Dec 17, 2022 · 2 comments
Closed
4 tasks done
Labels
duplicate This issue or pull request already exists

Comments

@JoshuaKGoldberg
Copy link
Member

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
@JoshuaKGoldberg JoshuaKGoldberg added bug Something isn't working triage Waiting for team members to take a look labels Dec 17, 2022
@bradzacher
Copy link
Member

Same as #6192

It's supposed to be Expression not LeftHandSideExpression

@JoshuaKGoldberg
Copy link
Member Author

Ah great!

@JoshuaKGoldberg JoshuaKGoldberg added duplicate This issue or pull request already exists and removed bug Something isn't working triage Waiting for team members to take a look labels Dec 17, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 25, 2022
@JoshuaKGoldberg JoshuaKGoldberg closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants