-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Meta: BreakingPackage: browserIssues related to the Sentry Browser SDKIssues related to the Sentry Browser SDKType: Improvement
Milestone
Description
Problem Statement
TIL: In the browser SDK, we export a wrap
function that people can wrap around any function call.
It'll try/catch whatever happens inside and report an error to Sentry (using our internal wrap
function). This function is typed with any
.
sentry-javascript/packages/browser/src/sdk.ts
Lines 200 to 203 in b618a52
export function wrap(fn: (...args: any) => any): any { | |
return internalWrap(fn)(); | |
} | |
Solution Brainstorm
We should rewrite the type here to use generics:
export function wrap<F>(fn: () => F): F
We can now add the newly typed function and deprecate the any
-typed one to remove in v8
Alternative
Deprecate the function and remove it? I never saw this before and afaict it's not documented anywhere.
Metadata
Metadata
Assignees
Labels
Meta: BreakingPackage: browserIssues related to the Sentry Browser SDKIssues related to the Sentry Browser SDKType: Improvement