May the defineProperty method of a proxy handler throw a TypeError?

David Flanagan dflanagan at
Wed May 25 11:30:36 PDT 2011

I'm using a proxy to implement the DOM NodeList interface.  A NodeList 
object is array-like and has read-only, non-configurable array index 

In my handler's set() and delete() methods, I just return false if an 
attempt is made to set or delete an indexed property.

The defineProperty() method is not parallel to set() and delete(), 
however.  I can't just return false, since the return value is ignored.  
And I can't tell from the proposal whether I am allowed to throw a 
TypeError from this method. In getOwnPropertyDescriptor() I know that I 
have to lie and return a descriptor with configurable:true for the 
indexed properties. So in defineProperty() should I just silently ignore 
any attempts to set an indexed property, or should I actively reject 
those attempts with a TypeError?

More information about the es-discuss mailing list