File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
Original file line number Diff line number Diff line change @@ -125,26 +125,27 @@ function wrapMethodWithSentry<T extends (...args: any[]) => any>(
125
125
* }
126
126
*
127
127
* export const MyDurableObject = instrumentDurableObjectWithSentry(
128
- * env => ({
128
+ * ( env: Env) => ({
129
129
* dsn: env.SENTRY_DSN,
130
130
* tracesSampleRate: 1.0,
131
131
* }),
132
132
* MyDurableObjectBase,
133
133
* );
134
134
* ```
135
135
*/
136
- export function instrumentDurableObjectWithSentry <
137
- E ,
138
- T extends DurableObject & Rpc . DurableObjectBranded ,
139
- C extends new ( ctx : DurableObjectState , env : E ) => T ,
140
- > ( optionsCallback : ( env : E ) => CloudflareOptions , DurableObjectClass : C ) : C {
141
- return new Proxy ( DurableObjectClass , {
136
+ export function instrumentDurableObjectWithSentry < E , C > (
137
+ optionsCallback : ( env : E ) => CloudflareOptions ,
138
+ DurableObjectClass : C ,
139
+ ) : C {
140
+ // We need to use `any` here because of type issues with the Durable Object constructor.
141
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
142
+ return new Proxy ( DurableObjectClass as any , {
142
143
construct ( target , [ context , env ] ) {
143
144
setAsyncLocalStorageAsyncContextStrategy ( ) ;
144
145
145
146
const options = getFinalOptions ( optionsCallback ( env ) , env ) ;
146
147
147
- const obj = new target ( context , env ) ;
148
+ const obj = new target ( context , env ) as DurableObject & Rpc . DurableObjectBranded ;
148
149
149
150
// These are the methods that are available on a Durable Object
150
151
// ref: https://developers.cloudflare.com/durable-objects/api/base/
You can’t perform that action at this time.
0 commit comments