From b82f59df71a6b6553fcaf816ba1ffb4fd2fd16a9 Mon Sep 17 00:00:00 2001 From: Travis DePrato <773453+travigd@users.noreply.github.com> Date: Fri, 3 Dec 2021 15:16:09 -0800 Subject: [PATCH] Fix bivariance issues in Sentry.Options TS type Fixes #4233 (at least in just this one file -- haven't checked anything else, but this seems like the most important since it's the place people are most likely to pass in their own functions). --- packages/types/src/options.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/types/src/options.ts b/packages/types/src/options.ts index 26f86de91e61..f746db3412b9 100644 --- a/packages/types/src/options.ts +++ b/packages/types/src/options.ts @@ -167,7 +167,7 @@ export interface Options { * @returns A sample rate between 0 and 1 (0 drops the trace, 1 guarantees it will be sent). Returning `true` is * equivalent to returning 1 and returning `false` is equivalent to returning 0. */ - tracesSampler?(samplingContext: SamplingContext): number | boolean; + tracesSampler?: (samplingContext: SamplingContext) => number | boolean; /** * A callback invoked during event submission, allowing to optionally modify @@ -181,7 +181,7 @@ export interface Options { * @param hint May contain additional information about the original exception. * @returns A new event that will be sent | null. */ - beforeSend?(event: Event, hint?: EventHint): PromiseLike | Event | null; + beforeSend?: (event: Event, hint?: EventHint) => PromiseLike | Event | null; /** * A callback invoked when adding a breadcrumb, allowing to optionally modify @@ -194,5 +194,5 @@ export interface Options { * @param breadcrumb The breadcrumb as created by the SDK. * @returns The breadcrumb that will be added | null. */ - beforeBreadcrumb?(breadcrumb: Breadcrumb, hint?: BreadcrumbHint): Breadcrumb | null; + beforeBreadcrumb?: (breadcrumb: Breadcrumb, hint?: BreadcrumbHint) => Breadcrumb | null; }