Skip to content

Commit

Permalink
allow overwriting array methods even on frozen objects
Browse files Browse the repository at this point in the history
  • Loading branch information
tobowers committed Dec 19, 2023
1 parent 7234609 commit 0a9e1f1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/core/src/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ function arrayImplementation<T>(arr: Y.Array<T>) {

const ret = [];
for (let method in methods) {
ret[method] = methods[method];
Object.defineProperty(ret, method, {
value: methods[method],
writable: true,
configurable: true
})
}

// this is necessary to prevent errors like "trap reported non-configurability for property 'length' which is either non-existent or configurable in the proxy target" when adding support for ownKeys and Reflect.keysx
Expand Down

0 comments on commit 0a9e1f1

Please sign in to comment.