Let's say we have WrapperClass
export abstract class WrapperClass {
protected abstract childMethod(): unknown;
wrapperMethod(): unknown {
const result = this.childMethod();
return result;
}
}
ChildClass
export class ChildClass extends WrapperClass {
protected childMethod(): ChildResponse {
const response = new ChildResponse();
return response;
}
}
I want typescript to automatically determine that response is of type ChildResponse when I do this:
const childClass = new ChildClass();
const response = childClass.wrapperMethod();
console.log(response.id);