Question about proxies and non-class inheritance with private fields

Oriol _ oriol-bugzilla at
Sun Aug 27 19:43:12 UTC 2017

A proxy object emulates its target because the essential internal methods are redirected to the target by default.
However, this does not happen with other internal slots, so I don't see why it should be different for private fields.
More examples:

new Number(123).valueOf(); // 123
new Proxy(new Number(123), {}).valueOf(); // TypeError: valueOf method called on incompatible Proxy

new Set().has(1); // false
new Proxy(new Set(), {}).has(1); // TypeError: has method called on incompatible Proxy

// Assuming a web browser
document.nodeType; // 9
new Proxy(document, {}).nodeType; // TypeError: 'get nodeType' called on an object that does not implement interface Node.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list