Skip to content

The 'this' context of type 'T' is not assignable to method's 'this' of type 'this'. #51198

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
Jack-Works opened this issue Oct 17, 2022 · 0 comments · Fixed by #51216
Closed
Labels
Bug A bug in TypeScript Help Wanted You can do this
Milestone

Comments

@Jack-Works
Copy link
Contributor

Bug Report

The 'this' context of type 'T' is not assignable to method's 'this' of type 'this'.
'this' could be instantiated with an arbitrary type which could be unrelated to 'T'.(2684)

🔎 Search Terms

class this parameter inheritance super

🕗 Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about class

⏯ Playground Link

Playground link with relevant code

💻 Code

export class T {
  base(this: this) {}
}
class T2 extends T {
  f(this: this) {
    super.base()
//  ~~~~~
//  The 'this' context of type 'T' is not assignable to method's 'this' of type 'this'.
//    'this' could be instantiated with an arbitrary type which could be unrelated to 'T'.(2684)
  }
}

🙁 Actual behavior

Not works

🙂 Expected behavior

Works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Help Wanted You can do this
Projects
None yet
2 participants