Encountering Setup Issue with Raygun in Angular Version 6 Using TypeScript
Problem:
ERROR in src/app/app.raygun.setup.ts(6,20): error TS2304: Cannot find name 'RaygunV2'.
This specific line seems to be causing trouble: declare let rg4js: RaygunV2;
I've added these npm packages for Raygun:
@types/raygun4js: "^2.6.0 AND raygun4j": "^2.10.0
File: app.raygun.setup:
import * as rg4js from 'raygun4js';
import { ErrorHandler } from '@angular/core';
import { environment } from '@env/environment';
declare let rg4js: RaygunV2;
rg4js('apiKey', '9bimuASis2Cyjx/mrKTmeQ==');
rg4js('setVersion', '1.0.0.0');
rg4js('enableCrashReporting', environment.raygun.isActive);
export class RaygunErrorHandler implements ErrorHandler {
handleError(e: any) {
rg4js('send', { error: e });
}
}
Module: app.module:
providers: [
{ provide: ErrorHandler, useClass: RaygunErrorHandler }
],