This JavaScript exception is not a non-null object that occurs if an object is not passed where it is expected. So the null is passed which is not an object and it will not work.
Message:
TypeError: Invalid descriptor for property {x} (Edge) TypeError: "x" is not a non-null object (Firefox) TypeError: Property description must be an object: "x" (Chrome) TypeError: Invalid value used in weak set (Chrome)
Error Type:
TypeError
Cause of Error: Somewhere in the code an object is expected and is not passed. Automatically null is passed which is not an object and it will not work. The user needs to provide a proper object in the given context.
Example 1: In this example, 1 is passed in the given method which is a non-null object, So the error has occurred.
Javascript
// 1 is non-null object Object.defineProperty({}, 'prop_name' , 1); |
Output(In Chrome console):
TypeError: Property description must be an object: 1
Example 2: In this example, the WeakSet object store object keys, Other types of keys are not accepted. So the error has occurred.
Javascript
let var1 = new WeakSet(); var1.add( 'GFG' ); |
Output(In Chrome console):
TypeError: Invalid value used in weak set