TypeError: Cannot match against ‘undefined’ or ‘null’

this error should only arise if the array or object being destructured or its children is undefined or null.

Exactly. In your case, the object being destructured is either undefined or null. For example,

function test(err, {a, b, c}) {
  console.log(err, a, b, c);
}

test(1, {a: 2, b: 3, c: 4});
// 1 2 3 4
test(1, {});
// 1 undefined undefined undefined
test(1);
// TypeError: Cannot match against 'undefined' or 'null'.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)