Argument of type ‘typeof DialogComponent’ is not assignable to parameter of type ‘ComponentType<typeof DialogComponent> | …>’


I have created a DialogService class and inside this class, among all, I have created a method called open() as follows:

...
public async open<TComponent extends ComponentType<TComponent> | TemplateRef<TComponent>, TData>(
      data: TData,
      component: TComponent
   ): Promise<TData> {
      ...
      this.dialog.open<TComponent, TData>(component, {
         width: '85%',
         height: '85vh',
         disableClose: true,
         hasBackdrop: true,
         panelClass: 'my-dialog',
         data: data
      }).afterClosed().subscribe(
         result => {
            ...
            ...
         }
      );
      return await promise;
   }
...

Somewhere in the body of dialog.component.html I use the *ngComponentOutlet in order to pass the child components to it. When this service is called by child components of the DialogComponent through Constructor Injection, I have the following method ( (click)="openDialog()" ) as follows:

...

@Component({...})
export ChildComponent {
   ...
   openDialog(): void {
      this.dialogService.open(dialogData, DialogComponent); // Here is the above-mentionend error thrown!
   }
   ...
}
...

Anybody has an idea how to get rid of such an error?

Thank you!