class Singleton {
static #shared;
static shared() {
this.#shared ??= 1;
return this.#shared;
}
}
is transformed to
import _assertClassBrand from "@oxc-project/runtime/helpers/assertClassBrand";
class Singleton {
static shared() {
_assertClassBrand(Singleton, this, _shared)._ ?? (_shared._ = _assertClassBrand(Singleton, this, null));
return _assertClassBrand(Singleton, this, _shared)._;
}
}
var _shared = { _: void 0 };
console.log(Singleton.shared());
but it should be
import _assertClassBrand from "@oxc-project/runtime/helpers/assertClassBrand";
class Singleton {
static shared() {
_assertClassBrand(Singleton, this, _shared)._ ?? (_shared._ = _assertClassBrand(Singleton, this, 1));
return _assertClassBrand(Singleton, this, _shared)._;
}
}
var _shared = { _: void 0 };
console.log(Singleton.shared());
.
playground
Originally reported at vitejs/vite#22338
is transformed to
but it should be
.
playground
Originally reported at vitejs/vite#22338