TypeScript
TypeScript copied to clipboard
The 'this' context of type 'T' is not assignable to method's 'this' of type 'this'.
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