diff --git a/typescript/raven.d.ts b/typescript/raven.d.ts index 0c2dec761eca..49a0fa52843f 100644 --- a/typescript/raven.d.ts +++ b/typescript/raven.d.ts @@ -82,6 +82,13 @@ declare module Raven { * 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). */ sampleRate?: number; + + /** + * By default, Raven.js attempts to suppress duplicate captured errors and messages that occur back-to-back. + * Such events are often triggered by rogue code (e.g. from a `setInterval` callback in a browser extension), + * are not actionable, and eat up your event quota. + */ + allowDuplicates?: boolean } interface RavenInstrumentationOptions { @@ -236,13 +243,13 @@ declare module Raven { isSetup(): boolean; /** Specify a function that allows mutation of the data payload right before being sent to Sentry. */ - setDataCallback(data: any, orig?: any): RavenStatic; + setDataCallback(callback?: RavenCallback): RavenStatic; /** Specify a callback function that allows you to mutate or filter breadcrumbs when they are captured. */ - setBreadcrumbCallback(data: any, orig?: any): RavenStatic; + setBreadcrumbCallback(callback?: RavenCallback): RavenStatic; /** Specify a callback function that allows you to apply your own filters to determine if the message should be sent to Sentry. */ - setShouldSendCallback(data: any, orig?: any): RavenStatic; + setShouldSendCallback(callback?: RavenCallback): RavenStatic; /** Show Sentry user feedback dialog */ showReportDialog(options?: Object): void; @@ -255,6 +262,8 @@ declare module Raven { setDSN(dsn: string): void; } + type RavenCallback = (data: any, orig?: (data: any) => any) => any | void; + interface RavenTransportOptions { url: string; data: any; @@ -263,8 +272,8 @@ declare module Raven { sentry_client: string; sentry_key: string; }; - onSuccess: () => void; - onFailure: () => void; + onSuccess(): void; + onError(error: Error & { request?: XMLHttpRequest }): void; } interface RavenPlugin {