Proxy drilling once again ...

You seem to fail to understand that the Proxy's target whole purpose is to enforce the language invariants for objects, and that it does not need to be the same as your intended/actual target.

If you want your proxy to have a certain behavior regarding kind (array, function, plain object), or own properties, you need the Proxy's target to have that behavior so that the Proxy steps from the spec enforcing the language invariants will be satisfied.

However the Proxy's target does not need to be the object that your proxy trap actually uses in their implementation, as long as the response from the trap is compatible with the Proxy's target.

In your previous thread I did warn you will encounter a lot more issues with proxy checks that will fail if the Proxy's handler does not act according to the target. For example enforcement of non-configurable non-writable own properties, and their stability over time.

This was all discussed recently in another thread: What is the rationale behind the invariants of the [[Get]] internal method of Proxy exotic objects?

3 Likes