You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(cloudflare): Account for static fields in wrapper type (#16303)
fixes#16247
By adjusting the generic, we'll make sure that we don't erase static
fields with the `instrumentDurableObjectWithSentry` function. See an
example below:
```js
class MyDurableObjectBase extends DurableObject {
public static readonly VERSION = '1.0.0';
}
const MyDurableObject = instrumentDurableObjectWithSentry(
() => ({
dsn: 'https://example.com/sentry',
tracesSampleRate: 1.0,
}),
MyDurableObjectBase,
);
console.log(MyDurableObject.VERSION); // This will now work correctly
```
By moving the `DurableObjectClass` into it's own generic (`new (state:
DurableObjectState, env: E) => T`), which we named `C`, it helps
preserve the exact constructor type of the input class, including all
its static properties and methods.
This was previously being lost by not aligning the `DurableObjectClass`
with the function return value.
0 commit comments