TypeScript/tests/baselines/reference/destructureComputedProperty.errors.txt

26 lines
1.3 KiB
Plaintext

tests/cases/compiler/destructureComputedProperty.ts(7,9): error TS2341: Property 'p' is private and only accessible within class 'C'.
tests/cases/compiler/destructureComputedProperty.ts(8,9): error TS2341: Property 'p' is private and only accessible within class 'C'.
tests/cases/compiler/destructureComputedProperty.ts(9,9): error TS2341: Property 'p' is private and only accessible within class 'C'.
tests/cases/compiler/destructureComputedProperty.ts(10,9): error TS2341: Property 'p' is private and only accessible within class 'C'.
==== tests/cases/compiler/destructureComputedProperty.ts (4 errors) ====
declare const ab: { n: number } | { n: string };
const nameN = "n";
const { [nameN]: n } = ab;
class C { private p: number; }
const nameP = "p";
const { "p": p0 } = new C();
~~~
!!! error TS2341: Property 'p' is private and only accessible within class 'C'.
const { ["p"]: p1 } = new C();
~~~~~
!!! error TS2341: Property 'p' is private and only accessible within class 'C'.
const { [nameP]: p2 } = new C();
~~~~~~~
!!! error TS2341: Property 'p' is private and only accessible within class 'C'.
const { p: p3 } = new C();
~
!!! error TS2341: Property 'p' is private and only accessible within class 'C'.