Building the class which has a static field and two or more private methods, private methods will be overwritten by the last one.
class T {
#a() { return 'a'; }
#b() { return 'b'; }
static c;
d() { console.log(this.#a()); }
}
The d() is expected to return 'a', but it returns 'b'.
Here is the output code
...
var _a, __create, _b, __create;
...
_a = new WeakSet();
__create = function() {
return "a";
};
_b = new WeakSet();
__create = function() {
return "b";
};
...
__create is declared twice, and the first __create is overwritten by the next one.
Building the class which has a static field and two or more private methods, private methods will be overwritten by the last one.
The
d()is expected to return'a', but it returns'b'.Here is the output code
__createis declared twice, and the first__createis overwritten by the next one.