sindresorhus/on-change

TypeError: Cannot read properties of undefined (reading 'Symbol(ProxyTarget)')

hpx7 opened this issue · 1 comments

hpx7 commented

To repro:

class Foo {
  x() {
    const tmp = this.y;
    tmp(); // no error if we call this.y() directly
  }

  y() {}
}

const foo = new Foo();
const proxiedFoo = onChange(foo, () => {});
proxiedFoo.x();

Error is thrown on this line:

const thisProxyTarget = thisArg[proxyTarget] || thisArg;

(thisArg is undefined)

Running into this same issue.