Currently, I am in the process of developing a custom Component that needs to be registered to a module. Here is how it is being done:
app.module.ts
import { createCustomElement } from "@angular/elements";
@NgModule({
declarations: [ExtensionComponent],
entryComponents: [ExtensionComponent],
imports: [BrowserModule],
bootstrap: []
})
export class AppModule {
constructor(private injector: Injector) {
}
ngDoBootstrap() {
const extension = createCustomElement(ExtensionComponent, { injector: this.injector });
customElements.define('caas-extension', extension);
}
}
However, during this process, I encountered an error at the last line where I define the custom element "extension".
Error
Argument of type 'NgElementConstructor<unknown>' is not assignable to parameter of type 'CustomElementConstructor'.
I have also updated the CLI version as suggested in another answer related to a similar issue. Below are the details of my current versions:
Angular CLI: 9.1.0-rc.0
Node: 12.13.0
OS: win32 x64
Angular: 9.1.0-rc.2