Skip to content

Commit 7d7eee2

Browse files
pgrmkamilogorek
authored andcommitted
fix: Updated typescript typings (#1134)
* change onFailure to onError and add correct parameter * fix callback typings * Review feedback * Additional changes I've found while debugging
1 parent f675c64 commit 7d7eee2

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

typescript/raven.d.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ declare module Raven {
8787
* A sampling rate to apply to events. A value of 0.0 will send no events, and a value of 1.0 will send all events (default).
8888
*/
8989
sampleRate?: number;
90+
91+
/**
92+
* By default, Raven.js attempts to suppress duplicate captured errors and messages that occur back-to-back.
93+
* Such events are often triggered by rogue code (e.g. from a `setInterval` callback in a browser extension),
94+
* are not actionable, and eat up your event quota.
95+
*/
96+
allowDuplicates?: boolean
9097
}
9198

9299
interface RavenInstrumentationOptions {
@@ -241,13 +248,13 @@ declare module Raven {
241248
isSetup(): boolean;
242249

243250
/** Specify a function that allows mutation of the data payload right before being sent to Sentry. */
244-
setDataCallback(data: any, orig?: any): RavenStatic;
251+
setDataCallback(callback?: RavenCallback): RavenStatic;
245252

246253
/** Specify a callback function that allows you to mutate or filter breadcrumbs when they are captured. */
247-
setBreadcrumbCallback(data: any, orig?: any): RavenStatic;
254+
setBreadcrumbCallback(callback?: RavenCallback): RavenStatic;
248255

249256
/** Specify a callback function that allows you to apply your own filters to determine if the message should be sent to Sentry. */
250-
setShouldSendCallback(data: any, orig?: any): RavenStatic;
257+
setShouldSendCallback(callback?: RavenCallback): RavenStatic;
251258

252259
/** Show Sentry user feedback dialog */
253260
showReportDialog(options?: Object): void;
@@ -260,6 +267,8 @@ declare module Raven {
260267
setDSN(dsn: string): void;
261268
}
262269

270+
type RavenCallback = (data: any, orig?: (data: any) => any) => any | void;
271+
263272
interface RavenTransportOptions {
264273
url: string;
265274
data: any;
@@ -268,8 +277,8 @@ declare module Raven {
268277
sentry_client: string;
269278
sentry_key: string;
270279
};
271-
onSuccess: () => void;
272-
onFailure: () => void;
280+
onSuccess(): void;
281+
onError(error: Error & { request?: XMLHttpRequest }): void;
273282
}
274283

275284
interface RavenPlugin {

0 commit comments

Comments
 (0)