Skip to content
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

this any typed in some JS object literals #22058

Open
mjbvz opened this issue Feb 20, 2018 · 2 comments
Open

this any typed in some JS object literals #22058

mjbvz opened this issue Feb 20, 2018 · 2 comments
Labels
Bug A bug in TypeScript Domain: JavaScript The issue relates to JavaScript specifically Has Repro This issue has compiler-backed repros: https://aka.ms/ts-repros VS Code Tracked There is a VS Code equivalent to this issue
Milestone

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Feb 20, 2018

From microsoft/vscode#43930

TypeScript Version: 2.8.0.insiders-20180211

Search Terms:

  • this
  • object literal

Code
For the js:

console.log({
    a: 1,
    b() {
        this
  }
});

Hover over this in b

Bug
this has any type

this is properly typed in cases like:

const z = {
    a: 1,
    b() {
        this
  }
}

Playground Link:

Related Issues:

@rubiesonthesky
Copy link

This is still an issue. Repro

console.log({
    a: 1,
    b() {
        this
//      ^?
  }
});

Workbench Repro

@typescript-bot typescript-bot added the Has Repro This issue has compiler-backed repros: https://aka.ms/ts-repros label Mar 10, 2024
@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 11, 2024

👋 Hi, I'm the Repro bot. I can help narrow down and track compiler bugs across releases! This comment reflects the current state of this repro running against the nightly TypeScript.


Comment by @rubiesonthesky

⚠️ Assertions:

  • any

Historical Information
Version Reproduction Outputs
5.0.2, 5.1.3, 5.2.2, 5.3.2, 5.4.2

⚠️ Assertions:

  • any

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: JavaScript The issue relates to JavaScript specifically Has Repro This issue has compiler-backed repros: https://aka.ms/ts-repros VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

No branches or pull requests

6 participants