I changed my mind
This commit is contained in:
parent
90c26432f5
commit
c01a8c2f78
|
@ -43,7 +43,10 @@ const handler: ProxyHandler<any> = {
|
||||||
...Object.fromEntries(Object.getOwnPropertyNames(Reflect).map(propName =>
|
...Object.fromEntries(Object.getOwnPropertyNames(Reflect).map(propName =>
|
||||||
[propName, (target: any, ...args: any[]) => Reflect[propName](target[proxyLazyGet](), ...args)]
|
[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 => {
|
ownKeys: target => {
|
||||||
const keys = Reflect.ownKeys(target[proxyLazyGet]());
|
const keys = Reflect.ownKeys(target[proxyLazyGet]());
|
||||||
for (const key of unconfigurable) {
|
for (const key of unconfigurable) {
|
||||||
|
|
|
@ -22,7 +22,10 @@ const handler: ProxyHandler<any> = {
|
||||||
...Object.fromEntries(Object.getOwnPropertyNames(Reflect).map(propName =>
|
...Object.fromEntries(Object.getOwnPropertyNames(Reflect).map(propName =>
|
||||||
[propName, (target: any, ...args: any[]) => Reflect[propName](target[proxyInnerGet](), ...args)]
|
[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 => {
|
ownKeys: target => {
|
||||||
const keys = Reflect.ownKeys(target[proxyInnerGet]());
|
const keys = Reflect.ownKeys(target[proxyInnerGet]());
|
||||||
for (const key of unconfigurable) {
|
for (const key of unconfigurable) {
|
||||||
|
|
Loading…
Reference in a new issue