Invalid return value of ownKeys method in proxy

problem description

When ownKeys in

proxy is used, the return value for Object.getOwnPropertySymbols () Object.keys ()
is not the return value of the ownKeys method.

the environmental background of the problems and what methods you have tried

ts-node

related code)

let p = new Proxy({z: 1}, {
    ownKeys: function (...arg) {
        return ["z", "f", "c"]
    }
})

console.log(Object.getOwnPropertyNames(p))// [ "z", "f", "c" ]
console.log(Object.getOwnPropertySymbols(p)) // []
console.log(Object.keys(p)) //["z"]

what result do you expect? What is the error message actually seen?

according to the description of mdn, all three should be returned, but
does not intercept all log,3 methods in ownKeys , but the return values are not the same.

Menu