mirror of
https://github.com/swc-project/swc.git
synced 2024-12-29 16:42:28 +03:00
18 lines
474 B
TypeScript
18 lines
474 B
TypeScript
|
// @target: es2015
|
||
|
|
||
|
class Parent<T> {
|
||
|
#foo = 3;
|
||
|
static #bar = 5;
|
||
|
accessChildProps() {
|
||
|
new Child<string>().#foo; // OK (`#foo` was added when `Parent`'s constructor was called on `child`)
|
||
|
Child.#bar; // Error: not found
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class Child<T> extends Parent<T> {
|
||
|
#foo = "foo"; // OK (Child's #foo does not conflict, as `Parent`'s `#foo` is not accessible)
|
||
|
#bar = "bar"; // OK
|
||
|
}
|
||
|
|
||
|
new Parent<number>().accessChildProps();
|