Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow overwriting array methods even on frozen objects #123

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading