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

14 lines
459 B
TypeScript
Raw Normal View History

// @strict: true
// @target: es6
class A {
[k: string]: any;
#foo = 3;
["#bar"] = this["#bar"] // Error (private identifiers should not prevent circularity checking for computeds)
constructor(message: string) {
this.#f = 3 // Error (index signatures do not implicitly declare private names)
this["#foo"] = 3; // Okay (type has index signature and "#foo" does not collide with private identifier #foo)
}
}