Given this definition from MDN:
The TypeError object represents an error when a value is not of the expected type.
Consider this example:
const primitiveTest = 1;
primitiveTest = 2;
TypeError: invalid assignment to const "x" (Firefox)
TypeError: Assignment to constant variable. (Chrome)
TypeError: Assignment to const (Edge)
TypeError: Redeclaration of const 'x' (IE)
But why the TypeError when trying to change primitive values? Why not maybe a syntax error or some other kind of error. What is the logic behind the choice for a TypeError in this case?