Invalid output for class with `.prototype.constructor` deleted
overlookmotel opened this issue · 0 comments
overlookmotel commented
Input:
class C {}
delete C.prototype.constructor;
export default C;
Output:
export default Object.defineProperties(
class C {},
{prototype: {value: {}}
});
This output throws error TypeError: Cannot redefine property: prototype
.
The output would be correct if C
was a function, not a class. Problem is that the prototype
property of classes is not writable or configurable (unlike functions).