im trying to type an untyped library and the api exports a Chessboard class. The tricky part is that if you specify an Extension some functions might be registered to the chessboard class.
Meaning the constructor of the RenderVideo will get the chessboard and add some functions to the chessboard class.
I am having difficulties coming up with something which types this
export class Extension {
chessboard: Chessboard
constructor(chessboard: Chessboard);
registerExtensionPoint(name: ExtensionPoint, callback: Function): void
}
export class RenderVideo extends Extension {
constructor(chessboard: Chessboard, props: {
mediaType: string
safariMode: boolean
});
cloneImageAndRender(): Promise<void>;
transferComputedStyle(element: Element): void;
makeSpriteInline(): void;
}
export class Chessboard {
constructor(context: HTMLElement, props: {
extensions: Array<{ class: typeof Extension; props: any }>;
});
}