Open
Description
Describe the bug
From today's TC39 meeting, the committee has decided to reverse the order of initializers.
Input code
function minusTwo({ set, get }) {
return {
set(v) {
set.call(this, v - 2)
},
init(v) {
return v - 2;
}
}
}
function timesFour({ set, get }) {
return {
set(v) {
set.call(this, v * 4)
},
init(v) {
return v * 4;
}
}
}
class Foo {
@minusTwo @timesFour accessor bar = 5;
}
const foo = new Foo();
console.log({ init: foo.bar });
foo.bar = 5;
console.log({ set: foo.bar });
Config
{
"jsc": {
"transform": {
"useDefineForClassFields": true,
"decoratorVersion": "2022-03"
},
"parser": {
"syntax": "typescript",
"decorators": true
},
"target": "es2015",
"loose": false,
},
"module": {
"type": "es6"
},
"isModule": true,
"minify": false
}
Playground link
Expected behavior
The set and init logs should be equivalent, because init runs minusTwo
's init first then timesFour
's.
"{init: 12}"
"{set: 12}"
Actual behavior
The set and init logs are different, because init runs timesFour
's init first then minusTwo
's.
"{init: 18}"
"{set: 12}"
Version
1.3.58
Additional context
No response