mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-11 06:46:03 +00:00
Align the error thrown for assigning to read-only collection properties
This commit is contained in:
parent
741d19458b
commit
cf0f0d127f
@ -83,7 +83,10 @@ const traps = {
|
||||
return true;
|
||||
}
|
||||
|
||||
return Reflect.set(collection, property, value, collection);
|
||||
if (!Reflect.set(collection, property, value, collection)) {
|
||||
throw new TypeError(`Cannot assign to read only property '${property}'`)
|
||||
}
|
||||
return true;
|
||||
},
|
||||
ownKeys(collection) {
|
||||
return Reflect.ownKeys(collection).concat(Array.from({ length: collection.length }, (value, key) => String(key)));
|
||||
|
Loading…
x
Reference in New Issue
Block a user