I am working on an application where developers can specify which component they want to render a certain part. I need users to understand that they must implement an interface, but I'm struggling with correctly writing the typing.
export interface ICustomComponent {
templateObject: any;
}
export class MyComponent implements ICustomComponent {
}
export class MyLib {
constructor(
private yourComponent: ICustomComponent
) {}
}
new MyLib(MyComponent); <== Fails
Currently, I am coding in Angular and unable to use the new operator, instead relying on Angular to resolve and construct the component.
Here is an example that showcases the issue I am facing.
Does anyone have suggestions on how to solve this problem?