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

不羁岁月 提交于 2020-05-23 08:10:51

问题


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'


回答1:


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 


来源:https://stackoverflow.com/questions/60633792/argument-of-type-ngelementconstructorunknown-is-not-assignable-to-parameter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!