Remove class syntax for better babelification (2)#345
Conversation
|
I'm not against this as the code is non-controversial, but if the intent is for working around Chrome 7, which best I can guess is from around 2010? That seems silly? |
|
I can give a more realistic reason then: someone who is compiling a bundle and has a babel config set to anything that triggers pre-es2015 shims will receive a class shim from babel. The babel class shims do not work when inheriting from any "special" builtin-object (Error, Array, TypedArray are examples). This is because they make the mistake I did originally and transform the constructor to follow the In short, NodeError will not be an actual Error object if this occurs. That is, it won't have a stack trace, etc. |
|
In any case, the code as it exists on master is incorrect. $ node
Welcome to Node.js v21.6.1.
Type ".help" for more information.
> Buffer.alloc(1).write({})
Uncaught TypeError: argument must be a string
at Buffer.write (node:buffer:1086:17) {
code: 'ERR_INVALID_ARG_TYPE'
}I don't think util.inspect displays the |
|
Thanks for the added context @chjj |
Fixes the issues with #344.