Should class declarations contain a binding for class name in the scope for the class?
Klass in example below has 2 bindings - 1st at top level, 2nd within the class body.
class Klass {
static tryWrite() {
Klass = 123;
}
}
const CopyOfKlass = Klass;
// Reassignment of `Klass` in top level scope succeeds
Klass = 123;
console.log(Klass); // Logs 123
// Reassignment of `Klass` within class fails.
// `TypeError: Assignment to constant variable at Klass.tryWrite`
CopyOfKlass.tryWrite();
The outer binding is reassignable, whereas the binding within the class is read-only.