Hi,
I have integrated Sentry OK into 2 different Ionic 4 apps and everything seems to be working well.
I also have an older Ionic 3 app but when I install Sentry I get a load of typescript errors after importing sentry-cordova in app.module.ts. I’ve included the errors output from my terminal below.
I’ve tried excluding the Sentry package in my tsconfig.json, and also upgrading typescript from 2.0.9 to a newer version (but this broke my app). Does anyone know how I can remove these errors please?
Thanks in advance for any help.
> ionic-app-scripts serve --address localhost --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser
[app-scripts] [13:40:38] ionic-app-scripts 1.1.4
[app-scripts] [13:40:38] watch started ...
[app-scripts] [13:40:38] build dev started ...
[app-scripts] [13:40:38] clean started ...
[app-scripts] [13:40:38] clean finished in 8 ms
[app-scripts] [13:40:38] copy started ...
[app-scripts] [13:40:38] transpile started ...
[app-scripts] [13:40:44] typescript: node_modules/@sentry/types/dist/client.d.ts, line: 16
[app-scripts] ',' expected.
[app-scripts] L16: export interface Client<O extends Options = Options> {
[app-scripts] [13:40:44] typescript: node_modules/@sentry/utils/dist/syncpromise.d.ts, line: 1
[app-scripts] ',' expected.
[app-scripts] L1: declare type HandlerOnSuccess<T, U = any> = (value: T) => U | Thenable<U>;
[app-scripts] L2: declare type HandlerOnFail<U = any> = (reason: any) => U | Thenable<U>;
[app-scripts] ',' expected.
[app-scripts] L1: declare type HandlerOnSuccess<T, U = any> = (value: T) => U | Thenable<U>;
[app-scripts] [13:40:44] typescript: node_modules/@sentry/utils/dist/syncpromise.d.ts, line: 2
[app-scripts] L2: declare type HandlerOnFail<U = any> = (reason: any) => U | Thenable<U>;
[app-scripts] L3: /** JSDoc */
[app-scripts] ',' expected.
[app-scripts] [13:40:44] typescript: node_modules/@sentry/utils/dist/syncpromise.d.ts, line: 30
[app-scripts] L29: /** JSDoc */
[app-scripts] L30: then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefi
[app-scripts] L31: /** JSDoc */
[app-scripts] ',' expected.
[app-scripts] [13:40:44] typescript: node_modules/@sentry/utils/dist/syncpromise.d.ts, line: 30
[app-scripts] [13:40:44] typescript: node_modules/@sentry/browser/dist/version.d.ts, line: 1
[app-scripts] L29: /** JSDoc */
[app-scripts] L30: then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefi
[app-scripts] L31: /** JSDoc */
[app-scripts] Initializers are not allowed in ambient contexts.
[app-scripts] L1: export declare const SDK_NAME = "sentry.javascript.browser";
[app-scripts] L2: export declare const SDK_VERSION = "5.6.3";
[app-scripts] Initializers are not allowed in ambient contexts.
[app-scripts] [13:40:44] typescript: node_modules/@sentry/browser/dist/version.d.ts, line: 2
[app-scripts] [13:40:44] typescript: node_modules/@sentry/core/dist/baseclient.d.ts, line: 39
[app-scripts] [13:40:44] typescript: node_modules/@sentry/core/dist/sdk.d.ts, line: 3
[app-scripts] [13:40:44] typescript: node_modules/@sentry/core/dist/sdk.d.ts, line: 11
[app-scripts] L1: export declare const SDK_NAME = "sentry.javascript.browser";
[app-scripts] L2: export declare const SDK_VERSION = "5.6.3";
[app-scripts] L3: //# sourceMappingURL=version.d.ts.map
[app-scripts] Generic type 'Client<O, Options>' requires 2 type argument(s).
[app-scripts] L39: export declare abstract class BaseClient<B extends Backend, O extends Options> implements Client<O> {
[app-scripts] Generic type 'Client<O, Options>' requires 2 type argument(s).
[app-scripts] L2: /** A class object that can instanciate Client objects. */
[app-scripts] L3: export declare type ClientClass<F extends Client, O extends Options> = new (options: O) => F;
[app-scripts] Generic type 'Client<O, Options>' requires 2 type argument(s).
[app-scripts] L11: export declare function initAndBind<F extends Client, O extends Options>(clientClass: ClientClass<F, O>, opt
[app-scripts] L12: //# sourceMappingURL=sdk.d.ts.map
[app-scripts] Initializers are not allowed in ambient contexts.
[app-scripts] L21: export declare const API_VERSION = 3;
[app-scripts] [13:40:44] typescript: node_modules/@sentry/hub/dist/hub.d.ts, line: 21
[app-scripts] [13:40:44] typescript: node_modules/@sentry/hub/dist/hub.d.ts, line: 39
[app-scripts] [13:40:44] typescript: node_modules/@sentry/hub/dist/hub.d.ts, line: 54
[app-scripts] [13:40:44] typescript: node_modules/@sentry/hub/dist/hub.d.ts, line: 70
[app-scripts] [13:40:44] typescript: node_modules/@sentry/hub/dist/interfaces.d.ts, line: 9
[app-scripts] [13:40:44] typescript: node_modules/@sentry/hub/dist/span.d.ts, line: 32
[app-scripts] [13:40:44] typescript: node_modules/@sentry/types/dist/event.d.ts, line: 33
[app-scripts] Generic type 'Client<O, Options>' requires 2 type argument(s).
[app-scripts] L39: constructor(client?: Client, scope?: Scope, _version?: number);
[app-scripts] Generic type 'Client<O, Options>' requires 2 type argument(s).
[app-scripts] L54: bindClient(client?: Client): void;
[app-scripts] Generic type 'Client<O, Options>' requires 2 type argument(s).
[app-scripts] L70: getClient<C extends Client>(): C | undefined;
[app-scripts] L71: /** Returns the scope of the top stack. */
[app-scripts] Generic type 'Client<O, Options>' requires 2 type argument(s).
[app-scripts] L8: export interface Layer {
[app-scripts] L9: client?: Client;
[app-scripts] L10: scope?: Scope;
[app-scripts] Cannot find name 'object'.
[app-scripts] L32: toJSON(): object;
[app-scripts] Cannot find name 'object'.
[app-scripts] L32: contexts?: {
[app-scripts] L33: [key: string]: object;
[app-scripts] L34: };
[app-scripts] Generic type 'Client<O, Options>' requires 2 type argument(s).
[app-scripts] L26: bindClient(client?: Client): void;
[app-scripts] Generic type 'Client<O, Options>' requires 2 type argument(s).
[app-scripts] L60: /** Returns the client of the top stack. */
[app-scripts] L61: getClient(): Client | undefined;
[app-scripts] [13:40:44] typescript: node_modules/@sentry/types/dist/hub.d.ts, line: 26
[app-scripts] [13:40:44] typescript: node_modules/@sentry/types/dist/hub.d.ts, line: 61
[app-scripts] [13:40:44] typescript: node_modules/@sentry/types/dist/severity.d.ts, line: 4
[app-scripts] [13:40:44] typescript: node_modules/@sentry/types/dist/severity.d.ts, line: 6
[app-scripts] [13:40:44] typescript: node_modules/@sentry/types/dist/severity.d.ts, line: 8
[app-scripts] [13:40:44] typescript: node_modules/@sentry/types/dist/severity.d.ts, line: 10
[app-scripts] [13:40:44] typescript: node_modules/@sentry/types/dist/severity.d.ts, line: 12
[app-scripts] [13:40:44] typescript: node_modules/@sentry/types/dist/severity.d.ts, line: 14
[app-scripts] [13:40:44] typescript: node_modules/@sentry/types/dist/severity.d.ts, line: 16
[app-scripts] [13:40:44] typescript: node_modules/@sentry/types/dist/span.d.ts, line: 6
[app-scripts] In ambient enum declarations member initializer must be constant expression.
[app-scripts] L3: Fatal = "fatal",
[app-scripts] L4: /** JSDoc */
[app-scripts] L5: Error = "error",
[app-scripts] In ambient enum declarations member initializer must be constant expression.
[app-scripts] L5: Error = "error",
[app-scripts] L6: /** JSDoc */
[app-scripts] L7: Warning = "warning",
[app-scripts] In ambient enum declarations member initializer must be constant expression.
[app-scripts] L7: Warning = "warning",
[app-scripts] L8: /** JSDoc */
[app-scripts] L9: Log = "log",
[app-scripts] In ambient enum declarations member initializer must be constant expression.
[app-scripts] L9: Log = "log",
[app-scripts] L10: /** JSDoc */
[app-scripts] L11: Info = "info",
[app-scripts] In ambient enum declarations member initializer must be constant expression.
[app-scripts] L11: Info = "info",
[app-scripts] L12: /** JSDoc */
[app-scripts] L13: Debug = "debug",
[app-scripts] In ambient enum declarations member initializer must be constant expression.
[app-scripts] L13: Debug = "debug",
[app-scripts] L14: /** JSDoc */
[app-scripts] L15: Critical = "critical"
[app-scripts] In ambient enum declarations member initializer must be constant expression.
[app-scripts] L15: Critical = "critical"
[app-scripts] L17: export declare namespace Severity {
[app-scripts] Cannot find name 'object'.
[app-scripts] L5: toJSON(): object;
[app-scripts] L7: //# sourceMappingURL=span.d.ts.map
[app-scripts] In ambient enum declarations member initializer must be constant expression.
[app-scripts] L3: Unknown = "unknown",
[app-scripts] L4: /** The event was skipped due to configuration or callbacks. */
[app-scripts] L5: Skipped = "skipped",
[app-scripts] In ambient enum declarations member initializer must be constant expression.
[app-scripts] L5: Skipped = "skipped",
[app-scripts] L6: /** The event was sent to Sentry successfully. */
[app-scripts] L7: Success = "success",
[app-scripts] In ambient enum declarations member initializer must be constant expression.
[app-scripts] L7: Success = "success",
[app-scripts] [13:40:44] typescript: node_modules/@sentry/types/dist/status.d.ts, line: 4
[app-scripts] [13:40:44] typescript: node_modules/@sentry/types/dist/status.d.ts, line: 6
[app-scripts] [13:40:44] typescript: node_modules/@sentry/types/dist/status.d.ts, line: 8
[app-scripts] [13:40:44] typescript: node_modules/@sentry/types/dist/status.d.ts, line: 10
[app-scripts] [13:40:44] typescript: node_modules/@sentry/types/dist/status.d.ts, line: 12
[app-scripts] [13:40:44] typescript: node_modules/@sentry/types/dist/status.d.ts, line: 14
[app-scripts] [13:40:44] typescript: node_modules/@sentry/types/dist/transport.d.ts, line: 26
[app-scripts] [13:40:44] typescript: node_modules/@sentry/utils/dist/syncpromise.d.ts, line: 6
[app-scripts] [13:40:44] typescript: node_modules/@sentry/utils/dist/syncpromise.d.ts, line: 6
[app-scripts] [13:40:44] typescript: node_modules/@sentry/utils/dist/syncpromise.d.ts, line: 32
[app-scripts] [13:40:44] typescript: node_modules/sentry-cordova/dist/js/version.d.ts, line: 1
[app-scripts] [13:40:44] typescript: node_modules/sentry-cordova/dist/js/version.d.ts, line: 2
[app-scripts] L8: /** The client is currently rate limited and will try again later. */
[app-scripts] L9: RateLimit = "rate_limit",
[app-scripts] In ambient enum declarations member initializer must be constant expression.
[app-scripts] L9: RateLimit = "rate_limit",
[app-scripts] L10: /** The event could not be processed. */
[app-scripts] L11: Invalid = "invalid",
[app-scripts] In ambient enum declarations member initializer must be constant expression.
[app-scripts] L11: Invalid = "invalid",
[app-scripts] L12: /** A server-side error ocurred during submission. */
[app-scripts] L13: Failed = "failed"
[app-scripts] In ambient enum declarations member initializer must be constant expression.
[app-scripts] L13: Failed = "failed"
[app-scripts] L15: export declare namespace Status {
[app-scripts] Cannot find name 'object'.
[app-scripts] L25: /** Define custom headers */
[app-scripts] L26: headers?: object;
[app-scripts] L27: /** Set a HTTP proxy that should be used for outbound requests. */
[app-scripts] Generic type 'HandlerOnSuccess' requires 3 type argument(s).
[app-scripts] L5: /** JSDoc */
[app-scripts] L6: then<U>(onSuccess?: HandlerOnSuccess<T, U>, onFail?: HandlerOnFail<U> | ((reason: any) => void)): Thenab
[app-scripts] Generic type 'HandlerOnFail' requires 2 type argument(s).
[app-scripts] L5: /** JSDoc */
[app-scripts] L6: then<U>(onSuccess?: HandlerOnSuccess<T, U>, onFail?: HandlerOnFail<U> | ((reason: any) => void)): Thenab
[app-scripts] Generic type 'HandlerOnFail' requires 2 type argument(s).
[app-scripts] L31: /** JSDoc */
[app-scripts] L32: catch<U>(onFail: HandlerOnFail<U>): SyncPromise<U>;
[app-scripts] L33: /** JSDoc */
[app-scripts] Initializers are not allowed in ambient contexts.
[app-scripts] L1: export declare const SDK_NAME = "sentry.javascript.cordova";
[app-scripts] L2: export declare const SDK_VERSION = "0.17.0";
[app-scripts] Initializers are not allowed in ambient contexts.
[app-scripts] L1: export declare const SDK_NAME = "sentry.javascript.cordova";
[app-scripts] L2: export declare const SDK_VERSION = "0.17.0";
[app-scripts] L3: //# sourceMappingURL=version.d.ts.map
[app-scripts] [13:40:44] transpile
Also, here my app dependencies:
"dependencies": {
"@angular/common": "2.4.8",
"@angular/compiler": "2.4.8",
"@angular/compiler-cli": "2.4.8",
"@angular/core": "2.4.8",
"@angular/forms": "2.4.8",
"@angular/http": "2.4.8",
"@angular/platform-browser": "2.4.8",
"@angular/platform-browser-dynamic": "2.4.8",
"@angular/platform-server": "2.4.8",
"@ionic-native/badge": "^3.4.4",
"@ionic-native/core": "^3.6.1",
"@ionic-native/device": "^3.6.1",
"@ionic-native/geolocation": "^3.4.4",
"@ionic-native/globalization": "^3.4.4",
"@ionic-native/local-notifications": "^3.4.4",
"@ionic-native/splash-screen": "^3.4.4",
"@ionic-native/status-bar": "^3.4.4",
"@ionic/storage": "2.0.0",
"@types/handlebars": "^4.0.33",
"@types/jquery": "^2.0.32",
"@types/xml2js": "0.0.28",
"angular2-google-maps": "^0.16.0",
"cordova-android": "7.1.4",
"cordova-ios": "^5.1.1",
"cordova-plugin-badge": "^0.8.7",
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-device": "^1.1.7",
"cordova-plugin-geolocation": "^2.4.3",
"cordova-plugin-globalization": "^1.11.0",
"cordova-plugin-network-information": "^1.3.4",
"cordova-plugin-splashscreen": "^4.1.0",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-sqlite-storage": "^2.5.1",
"ionic-angular": "2.2.0",
"ionic-native": "2.4.1",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"jimp": "^0.2.28",
"lodash": "^4.16.6",
"moment": "2.15.2",
"moment-range": "^3.1.1",
"ng2-translate": "^4.0.0",
"rxjs": "5.0.1",
"sentry-cordova": "^0.17.0",
"sw-toolbox": "3.4.0",
"xml2js": "^0.4.17",
"zone.js": "0.7.2"
},
"devDependencies": {
"@ionic/app-scripts": "1.1.4",
"@ionic/cli-plugin-cordova": "1.6.2",
"@ionic/cli-plugin-ionic-angular": "1.4.1",
"@types/cryptojs": "3.1.29",
"@types/fullcalendar": "2.7.32",
"@types/jquery": "2.0.32",
"@types/lodash": "4.14.36",
"gulp-typedoc": "^2.0.2",
"ionic": "5.4.4",
"typedoc": "^0.5.7",
"typescript": "2.0.9"
},