1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
=== tests/cases/conformance/classes/members/privateNames/privateNamesInNestedClasses-1.ts ===
class A {
>A : A
#foo = "A's #foo";
>#foo : string
>"A's #foo" : "A's #foo"
#bar = "A's #bar";
>#bar : string
>"A's #bar" : "A's #bar"
method () {
>method : () => void
class B {
>B : B
#foo = "B's #foo";
>#foo : string
>"B's #foo" : "B's #foo"
bar (a: any) {
>bar : (a: any) => void
>a : any
a.#foo; // OK, no compile-time error, don't know what `a` is
>a.#foo : any
>a : any
}
baz (a: A) {
>baz : (a: A) => void
>a : A
a.#foo; // compile-time error, shadowed
>a.#foo : any
>a : A
}
quux (b: B) {
>quux : (b: B) => void
>b : B
b.#foo; // OK
>b.#foo : string
>b : B
}
}
const a = new A();
>a : A
>new A() : A
>A : typeof A
new B().bar(a);
>new B().bar(a) : void
>new B().bar : (a: any) => void
>new B() : B
>B : typeof B
>bar : (a: any) => void
>a : A
new B().baz(a);
>new B().baz(a) : void
>new B().baz : (a: A) => void
>new B() : B
>B : typeof B
>baz : (a: A) => void
>a : A
const b = new B();
>b : B
>new B() : B
>B : typeof B
new B().quux(b);
>new B().quux(b) : void
>new B().quux : (b: B) => void
>new B() : B
>B : typeof B
>quux : (b: B) => void
>b : B
}
}
new A().method();
>new A().method() : void
>new A().method : () => void
>new A() : A
>A : typeof A
>method : () => void
|