mirror of
https://github.com/swc-project/swc.git
synced 2024-12-18 19:21:33 +03:00
29 lines
581 B
TypeScript
29 lines
581 B
TypeScript
|
// @strict: true
|
||
|
// @target: es6
|
||
|
|
||
|
class A {
|
||
|
#foo = "A's #foo";
|
||
|
#bar = "A's #bar";
|
||
|
method () {
|
||
|
class B {
|
||
|
#foo = "B's #foo";
|
||
|
bar (a: any) {
|
||
|
a.#foo; // OK, no compile-time error, don't know what `a` is
|
||
|
}
|
||
|
baz (a: A) {
|
||
|
a.#foo; // compile-time error, shadowed
|
||
|
}
|
||
|
quux (b: B) {
|
||
|
b.#foo; // OK
|
||
|
}
|
||
|
}
|
||
|
const a = new A();
|
||
|
new B().bar(a);
|
||
|
new B().baz(a);
|
||
|
const b = new B();
|
||
|
new B().quux(b);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
new A().method();
|