'NgElementConstructor<unknown>' 类型的参数不可分配给 'CustomElementConstructor' 类型的参数

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

我在 VSCode( 1.44.0-insider ) 使用 Angular9 创建 Angular 元素时收到一个奇怪的警告:

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

helloElement 类型不被接受,打字稿出现错误消息:

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

似乎会在下一个版本中修复:https://github.com/angular/angular/pull/35864

您已经可以通过更新到下一个版本 (9.1.0-next.4) 来为您的项目测试它。

ng update @angular/core --next