How can I Proxy a Map, and then access the values
of the proxied map?
Here is the code I am attempting:
const things = new Proxy(new Map(), {
set(t, k, v) {
console.log(t, k, v);
Reflect.set(t, k, v);
}
});
things['foo'] = 'bar'
// console log: Map(0) {} "foo" "bar"
console.log(things['foo']);
// console log: "bar"
things.values()
Uncaught TypeError: Method Map.prototype.values called on incompatible receiver [object Object]
at Proxy.values (native)