swc/crates/swc_ecma_parser/tests/tsc/privateNameComputedPropertyName3.ts

26 lines
387 B
TypeScript
Raw Normal View History

// @target: esnext, es2022, es2015
class Foo {
#name;
constructor(name) {
this.#name = name;
}
getValue(x) {
const obj = this;
class Bar {
#y = 100;
[obj.#name]() {
return x + this.#y;
}
}
return new Bar()[obj.#name]();
}
}
console.log(new Foo("NAME").getValue(100));