Skip to content

Commit 18527ee

Browse files
committed
Fix lazyRef to work with Object.keys()
JS first calls ownKeys and then looks at the property descriptors to see if the key is enumerable. So we need to forward the descriptors as well for this to work.
1 parent c4df74d commit 18527ee

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/common/lazy-ref.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ export const lazyRef = <T extends object>(getter: () => T): T => {
2323
getPrototypeOf() {
2424
return Reflect.getPrototypeOf(getter());
2525
},
26+
getOwnPropertyDescriptor(target: T, p: string | symbol) {
27+
return Object.getOwnPropertyDescriptor(getter(), p);
28+
},
2629
});
2730
};
2831

0 commit comments

Comments
 (0)