Skip to content

Commit e8028fb

Browse files
author
cod1k
committed
Optimize method retrieval with Reflect.get for clarity
Replaced Object.getOwnPropertyDescriptor with Reflect.get to simplify and streamline method retrieval logic. This improves code readability and reduces unnecessary complexity in accessing prototype methods. No changes to functionality or behavior.
1 parent 3398466 commit e8028fb

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

packages/cloudflare/src/durableobject.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,7 @@ function instrumentPrototype<T extends NewableFunction>(
252252
continue;
253253
}
254254

255-
const descriptor = Object.getOwnPropertyDescriptor(proto, method) as {
256-
value?: OriginalMethod;
257-
get?: () => OriginalMethod;
258-
};
259-
const value = descriptor.value ?? descriptor.get?.();
255+
const value = Reflect.get(proto, method, proto);
260256
if (typeof value === 'function') {
261257
sentryMethods.set(
262258
method,

0 commit comments

Comments
 (0)