I was using super.class(BaseClass) in may cases and it handles typing correctly.
I see: protected class<U extends T>(type: U): U; in the .d.ts file
I was trying out getPrototypeListOf and realized that I was getting all the baseClass as any
And I saw: export function getPrototypeListOf(o: any): any[]; in the .d.ts file
So, creating this issue to potentially improve the typing here to get more accurate types
PS: I have no idea if it is possible at all :)
I did try this:
export class ChildClass extends classes(BaseClass1, BaseClass2) {
myFunc() {
(getPrototypeListOf(ChildClass) as (BaseClass1 | BaseClass2)[]).forEach(baseClass => {
baseClass.myFunc()
})
}
}
NOTE: This will assume baseClass has the type (typeof BaseClass1 | typeof BaseClass2)
So, if all my base classes implement a particular function - then this work out quite well
Doing: getPrototypeListOf(ChildClass) as [BaseClass1, BaseClass2] would also work and be more accurate
I was using
super.class(BaseClass)in may cases and it handles typing correctly.I see:
protected class<U extends T>(type: U): U;in the.d.tsfileI was trying out
getPrototypeListOfand realized that I was getting all the baseClass asanyAnd I saw:
export function getPrototypeListOf(o: any): any[];in the.d.tsfileSo, creating this issue to potentially improve the typing here to get more accurate types
PS: I have no idea if it is possible at all :)
I did try this:
NOTE: This will assume
baseClasshas the type(typeof BaseClass1 | typeof BaseClass2)So, if all my base classes implement a particular function - then this work out quite well
Doing:
getPrototypeListOf(ChildClass) as [BaseClass1, BaseClass2]would also work and be more accurate