angular - 将 TS 定义添加到 WebComponents
问题描述
@abc/ui-webcomponents
导出一堆建立在(plain js)之上的WebComponents LitElement
,如下所示:
export class AbcButton extends LitElement {
static get properties() {
return {
foo: {
type: Boolean
},
bar: {
type: String
}
};
}
render() {
return html`...`;
}
}
window.customElements.define('abc-button', AbcButton);
由于主要用于 Angular 项目,因此拥有描述属性的定义@abc/ui-webcomponents
会很有帮助。.d.ts
我一直在尝试以下方法,但没有成功:
interface HTMLElementTagNameMap {
'abc-button': NgElement & WithProperties<{foo: string, bar: string}>;
// or
'abc-button': AbcButton;
}
至少
在. <abc-
_ <abc-button f
_app.component.html
解决方案
推荐阅读
- ilnumerics - 在 Visual Studio 输出中禁用 ILNumerics 缓冲区消息
- powershell - PowerShell:IF 语句中的多个条件
- excel - VBA:从工作表中删除信息
- docker - Docker pull 找不到“最新”标签
- python - ROS Noetic 没有名为 'rqt_py_common' 的模块
- javascript - 如何使用表格方法分页实现卡片分页
- mysql - SQLalchemy Json-configured varchar:如何过滤
- javascript - Vue双表单中继器
- gradle - 在 Gradle buid 脚本中将第 3 方依赖项标记为已弃用
- arrays - 如何在 vhdl 中初始化大小数组