简体   繁体   中英

Argument of type 'NgElementConstructor<unknown>' is not assignable to parameter of type 'CustomElementConstructor'

I'm getting a strange warning in VSCode( 1.44.0-insider ) with Angular9 in creating Angular Elements:

export class AppModule { 
  constructor(private injector: Injector) {
    const helloElement = createCustomElement(HelloComponent, {injector});
    customElements.define('my-hello', helloElement);
  }
  ngDoBootstrap() {}
}

type of helloElement is not accepted with an error message from typescript:

Argument of type 'NgElementConstructor' is not assignable to parameter of type 'CustomElementConstructor'

It seems it will be fixed with the next release: https://github.com/angular/angular/pull/35864

You can already test it for your project by updating to the next release (9.1.0-next.4).

ng update @angular/core --next 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM