angular - 'NgElementConstructor 类型的参数' 不可分配给“CustomElementConstructor”类型的参数
问题描述
在使用 Angular9 创建 Angular 元素时,我在 VSCode( 1.44.0-insider ) 中收到了一个奇怪的警告:
export class AppModule {
constructor(private injector: Injector) {
const helloElement = createCustomElement(HelloComponent, {injector});
customElements.define('my-hello', helloElement);
}
ngDoBootstrap() {}
}
type ofhelloElement
不被接受,并带有来自 typescript 的错误消息:
“NgElementConstructor”类型的参数不可分配给“CustomElementConstructor”类型的参数
解决方案
似乎它将在下一个版本中修复:https ://github.com/angular/angular/pull/35864
您已经可以通过更新到下一个版本 (9.1.0-next.4) 为您的项目测试它。
ng update @angular/core --next
推荐阅读
- python - pyplot 如何知道 pandas.DataFrame(...).cumprod().plot() 的输出所绘制的内容
- regex - 使用linux命令删除换行符
- javascript - 如何使用 Chart.js 在 Vue 中将计算属性与数据对象中 JSON 的数据一起用于时间轴
- postgresql - 使用 PostgreSQL 从 Well Known Text 创建 GeoJSON 输出
- node.js - 异步函数执行顺序错误
- r - 在r中绘制多条水平线
- node.js - 带有 Promise 的错误数据库触发云功能
- sql - sysdate 格式在 where 子句中不起作用
- r - 使用 ifelse 条件拆分 R 中的列
- android - 自定义字体不适用于 EMUI 或自定义 Android 操作系统