I use app insights library in my angular project. And I use eslint to lint the code which really helps find some weird bugs:
@Injectable({ providedIn: "root" })
export class AppInsightsService {
appInsights: ApplicationInsights;
constructor() {
this.appInsights = new ApplicationInsights({ // ====> HERE
config: {
instrumentationKey: environment.appInsights.instrumentationKey,
enableAutoRouteTracking: true
}
});
this.appInsights.loadAppInsights(); // ====> HERE
}
logPageView(name?: string, url?: string): void {
this.appInsights.trackPageView({ // ====> AND HERE
name,
uri: url
});
}
...
}
But lint shows the following errors for the lines where I added comments:
Unsafe assignment of an
any
value.eslint@typescript-eslint/no-unsafe-assignment)
Can someone explain please what's wrong with the appInsights
field?