💻
How are you using Babel?
@babel/register or @babel/node
Input code
function init(_value, {name, addInitializer}) {
addInitializer(function () {
console.log(name, typeof this);
});
}
class C {
@init static accessor staticAcc;
@init protoMethod() {}
}
console.log('=== Instantiation ===');
const inst = new C();
Configuration file name
babel.config.json
Configuration
{
"plugins": [
["@babel/plugin-proposal-decorators", {"version": "2022-03"}]
]
}
Current and expected behavior
Actual output:
staticAcc function
protoMethod function
=== Instantiation ===
Expected output:
staticAcc function
=== Instantiation ===
protoMethod object
With the accessor commented out, the output is:
=== Instantiation ===
protoMethod object
Environment
System:
OS: macOS 12.6
Binaries:
Node: 18.10.0 - /usr/local/bin/node
npm: 8.19.2 - /usr/local/bin/npm
npmPackages:
@babel/core: ^7.19.3 => 7.19.3
@babel/node: ^7.19.1 => 7.19.1
@babel/plugin-proposal-decorators: ^7.19.3 => 7.19.3
Possible solution
No response
Additional context
💻
How are you using Babel?
@babel/register or @babel/node
Input code
Configuration file name
babel.config.json
Configuration
{ "plugins": [ ["@babel/plugin-proposal-decorators", {"version": "2022-03"}] ] }Current and expected behavior
Actual output:
Expected output:
With the accessor commented out, the output is:
Environment
Possible solution
No response
Additional context
accessor).