@@ -25,6 +25,8 @@ import {
2525 * @param handler {ExportedHandler} The handler to wrap.
2626 * @returns The wrapped handler.
2727 */
28+ // TODO(v11): The generic types need to be rewritten to following to improve type safety:
29+ // T extends ExportedHandler<any, any, any> | WorkerEntrypointConstructor<any, any>
2830export function withSentry <
2931 Env = typeof cloudflareEnv ,
3032 QueueHandlerMessage = unknown ,
@@ -34,20 +36,26 @@ export function withSentry<
3436 QueueHandlerMessage ,
3537 CfHostMetadata
3638 > ,
37- > ( optionsCallback : ( env : typeof cloudflareEnv ) => CloudflareOptions | undefined , handler : T ) : T {
39+ > ( optionsCallback : ( env : Env ) => CloudflareOptions | undefined , handler : T ) : T {
3840 if ( isCloudflareClass ( handler , 'WorkerEntrypoint' ) ) {
39- return instrumentWorkerEntrypoint ( optionsCallback , handler ) ;
41+ // oxlint-disable-next-line typescript/no-explicit-any
42+ return instrumentWorkerEntrypoint ( optionsCallback as any , handler ) ;
4043 }
4144
4245 setAsyncLocalStorageAsyncContextStrategy ( ) ;
4346
4447 try {
45- instrumentExportedHandlerFetch ( handler , optionsCallback ) ;
48+ // oxlint-disable-next-line typescript/no-explicit-any
49+ instrumentExportedHandlerFetch ( handler , optionsCallback as any ) ;
4650 instrumentHonoErrorHandler ( handler ) ;
47- instrumentExportedHandlerScheduled ( handler , optionsCallback ) ;
48- instrumentExportedHandlerEmail ( handler , optionsCallback ) ;
49- instrumentExportedHandlerQueue ( handler , optionsCallback ) ;
50- instrumentExportedHandlerTail ( handler , optionsCallback ) ;
51+ // oxlint-disable-next-line typescript/no-explicit-any
52+ instrumentExportedHandlerScheduled ( handler , optionsCallback as any ) ;
53+ // oxlint-disable-next-line typescript/no-explicit-any
54+ instrumentExportedHandlerEmail ( handler , optionsCallback as any ) ;
55+ // oxlint-disable-next-line typescript/no-explicit-any
56+ instrumentExportedHandlerQueue ( handler , optionsCallback as any ) ;
57+ // oxlint-disable-next-line typescript/no-explicit-any
58+ instrumentExportedHandlerTail ( handler , optionsCallback as any ) ;
5159 // This is here because Miniflare sometimes cannot get instrumented
5260 } catch {
5361 // Do not console anything here, we don't want to spam the console with errors
0 commit comments