swc/crates/swc_ecma_parser/tests/tsc/privateNamesUnique-3.ts
2022-02-04 17:08:38 +09:00

16 lines
440 B
TypeScript

// @target: es2015
class A {
#foo = 1;
static #foo = true; // error (duplicate)
// because static and instance private names
// share the same lexical scope
// https://tc39.es/proposal-class-fields/#prod-ClassBody
}
class B {
static #foo = true;
test(x: B) {
x.#foo; // error (#foo is a static property on B, not an instance property)
}
}