我正在尝试在一个Angular 项目上使用NgZone:
constructor(
private fishboneService: FishboneService,
private zone: NgZone,
) {
window['angularComponentReference'] = {
zone: this.zone,
componentFn: (value: any) => this.getDataFromOutside(value),
component: this
};
console.log('reference added');
}
但我得到以下错误:
元素隐式具有“any”类型,因为索引表达式不是“number”类型。
19窗口['Angular 组件引用'] = {
1条答案
按热度按时间sqxo8psd1#
您可以在代码前面加上ts-ignore。请参阅https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-6.html#suppress-errors-in-ts-files-using--ts-ignore-comments