Closed ExE-Boss closed 4 years ago
This is because Object.getOwnPropertyNames(target) and Object.getOwnPropertySymbols(target) both invoke target.[[OwnPropertyKeys]](), which Reflect.ownKeys(target) does only once, which is observable when using Proxies.
Object.getOwnPropertyNames(target)
Object.getOwnPropertySymbols(target)
target.[[OwnPropertyKeys]]()
Reflect.ownKeys(target)
This will also make the OwnPropertyKeys helper throw a TypeError for non‑object targets in all ECMAScript environments, instead of just in ES5 environments.
OwnPropertyKeys
TypeError
object
review?(@ljharb)
This is because
Object.getOwnPropertyNames(target)
andObject.getOwnPropertySymbols(target)
both invoketarget.[[OwnPropertyKeys]]()
, whichReflect.ownKeys(target)
does only once, which is observable when using Proxies.This will also make the
OwnPropertyKeys
helper throw aTypeError
for non‑object
targets in all ECMAScript environments, instead of just in ES5 environments.review?(@ljharb)