I'm encountering an issue where TypeScript is throwing a lot of errors when trying to utilize the ReturnType of a method from an abstract class in a child class.
Here's a simple example that illustrates the problem:
Thank you
abstract class Parent<A>{
private _value:A
constructor (value:A){
this._value=value
}
protected getValue():A {
return this._value
}
}
class ChildString extends Parent<string>{
constructor(value:string){
super(value)
}
public stringValue():ReturnType<typeof this.getValue> { //<---- error is here
return this.getValue()
}
}
The error message I am receiving is similar to:
Return type of public method from exported class has or is using private 'this'