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
|
tests/cases/conformance/classes/members/privateNames/privateNameNestedMethodAccess.ts(11,25): error TS18014: The property '#bar' cannot be accessed on type 'C' within this class because it is shadowed by another private identifier with the same spelling.
tests/cases/conformance/classes/members/privateNames/privateNameNestedMethodAccess.ts(19,19): error TS2339: Property '#unknown' does not exist on type 'any'.
==== tests/cases/conformance/classes/members/privateNames/privateNameNestedMethodAccess.ts (2 errors) ====
class C {
#foo = 42;
#bar() { new C().#baz; }
get #baz() { return 42; }
m() {
return class D {
#bar() {}
constructor() {
new C().#foo;
new C().#bar; // Error
~~~~
!!! error TS18014: The property '#bar' cannot be accessed on type 'C' within this class because it is shadowed by another private identifier with the same spelling.
!!! related TS18017 tests/cases/conformance/classes/members/privateNames/privateNameNestedMethodAccess.ts:8:13: The shadowing declaration of '#bar' is defined here
!!! related TS18018 tests/cases/conformance/classes/members/privateNames/privateNameNestedMethodAccess.ts:3:5: The declaration of '#bar' that you probably intended to use is defined here
new C().#baz;
new D().#bar;
}
n(x: any) {
x.#foo;
x.#bar;
x.#unknown; // Error
~~~~~~~~
!!! error TS2339: Property '#unknown' does not exist on type 'any'.
}
}
}
}
|