class SomeClass<T extends string> {
protected someMethod(): void {
}
protected someOtherMethod(): ReturnType<this["someMethod"]> {
// Private or protected member 'someMethod' cannot be accessed on a type parameter.ts(4105)
}
}
Is there any way to reference back the type of protected class member in the class itself?
This can easily solved by using the class name instead of this
:
class SomeClass {
protected someMethod(): void {
}
protected someOtherMethod(): ReturnType<SomeClass["someMethod"]> {
}
}
Playground Link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With