property-description-must-be-an-object-not-string.js (759B)
1 // Copyright (C) 2020 Rick Waldron. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-object.defineproperty 5 description: > 6 Property description must be an object (string) 7 info: | 8 ObjectDefineProperties ( O, Properties ) 9 10 ... 11 For each element nextKey of keys, do 12 Let propDesc be ? props.[[GetOwnProperty]](nextKey). 13 If propDesc is not undefined and propDesc.[[Enumerable]] is true, then 14 Let descObj be ? Get(props, nextKey). 15 Let desc be ? ToPropertyDescriptor(descObj). 16 ... 17 18 ToPropertyDescriptor ( Obj ) 19 20 If Type(Obj) is not Object, throw a TypeError exception. 21 ... 22 ---*/ 23 24 assert.throws(TypeError, () => { 25 Object.defineProperty({}, 'a', ''); 26 }); 27 28 reportCompare(0, 0);