Skip to content

fix: Typescript typings #1134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions typescript/raven.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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 {
Expand Down