I have a code line in my Angular 9 service ctor as "window['className'] = this;", there is no problem and it works w/ a winForm app based on cef sharp.
However, in Angular 12, the same code line (window['className'] = this;) report build error. The error message is TS7015: Element implicitly has an 'any' type because index expression is not of type 'number'.
import { Injectable, NgZone } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class OCPCommunicationService {
systemConfiguration$ = new BehaviorSubject('');
constructor(private window: Window, private zone: NgZone) {
window['OCPCommunicationService'] = this;
}
extSetConfiguration(systemConfiguration: string): void {
this.systemConfiguration$.next(systemConfiguration);
console.log('extSetConfiguration(): systemConfiguration', systemConfiguration);
}
public getConfiguratio(): string {
return this.systemConfiguration$.getValue();
}
}
What could be the issue? Thanks in advance!