I'm having trouble figuring out this simple (on the surface) problem. I'm looking to create a type that has the keys of both the parent class, and the current child I'm working on. I have these classes:
class A {
foo = 1;
xoo = 'abc';
get(){
return {} as ?;
}
}
class B extends A {
bar = 2;
zar = [1, 2, 3];
init() {
this.get(). // < -- should autocomplete and show both "foo" and "bar".
}
}
As you can see, I would like to have this.get() return a type that keys of both the Parent and Child that are of type number. In this case, the autocomplete should show both "foo" and "bar" as options, but not "init", "get", "xoo" or "zar". I've for a long while tried to get this working, but I think it's just beyond my knowledge at this point. Any help in accomplishing this and understanding the solution would be massively helpful!