Skip to content

Fix object literals lack of this references #43572

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

Merged
merged 2 commits into from
Apr 20, 2021
Merged

Fix object literals lack of this references #43572

merged 2 commits into from
Apr 20, 2021

Conversation

sangxxh
Copy link
Contributor

@sangxxh sangxxh commented Apr 7, 2021

Fixes #43530

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Apr 7, 2021
@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Apr 7, 2021

Is there a test to ensure that this in a property declaration isn't the same as this in a method/accessor?

let x = {
  foo: this,
  bar() {
    this;
  }
};

@sangxxh
Copy link
Contributor Author

sangxxh commented Apr 7, 2021

Not yet, I will add that case in.

Copy link
Member

@DanielRosenwasser DanielRosenwasser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These types of tests are kind of hard to read (and they only test the count), but this seems reasonable

@andrewbranch andrewbranch merged commit f270529 into microsoft:master Apr 20, 2021
@sangxxh sangxxh deleted the issue/43530-object-literals-lack-this-reference branch April 20, 2021 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reference highlighting for this lacking in object literals
4 participants