I changed my mind

This commit is contained in:
Nuckyz 2024-05-23 22:52:32 -03:00
parent 90c26432f5
commit c01a8c2f78
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
2 changed files with 8 additions and 2 deletions

View file

@ -43,7 +43,10 @@ const handler: ProxyHandler<any> = {
...Object.fromEntries(Object.getOwnPropertyNames(Reflect).map(propName =>
[propName, (target: any, ...args: any[]) => Reflect[propName](target[proxyLazyGet](), ...args)]
)),
set: (target, p, newValue) => Reflect.set(target[proxyLazyGet](), p, newValue, target[proxyLazyGet]()),
set: (target, p, newValue) => {
const lazyTarget = target[proxyLazyGet]();
return Reflect.set(lazyTarget, p, newValue, lazyTarget);
},
ownKeys: target => {
const keys = Reflect.ownKeys(target[proxyLazyGet]());
for (const key of unconfigurable) {

View file

@ -22,7 +22,10 @@ const handler: ProxyHandler<any> = {
...Object.fromEntries(Object.getOwnPropertyNames(Reflect).map(propName =>
[propName, (target: any, ...args: any[]) => Reflect[propName](target[proxyInnerGet](), ...args)]
)),
set: (target, p, value) => Reflect.set(target[proxyInnerGet](), p, value, target[proxyInnerGet]()),
set: (target, p, value) => {
const innerTarget = target[proxyInnerGet]();
return Reflect.set(innerTarget, p, value, innerTarget);
},
ownKeys: target => {
const keys = Reflect.ownKeys(target[proxyInnerGet]());
for (const key of unconfigurable) {