2014-09-19 15:37:55 +02:00
|
|
|
tests/cases/conformance/types/members/classWithPrivateProperty.ts(15,18): error TS2341: Property 'x' is private and only accessible within class 'C'.
|
|
|
|
tests/cases/conformance/types/members/classWithPrivateProperty.ts(16,18): error TS2341: Property 'a' is private and only accessible within class 'C'.
|
|
|
|
tests/cases/conformance/types/members/classWithPrivateProperty.ts(17,18): error TS2341: Property 'b' is private and only accessible within class 'C'.
|
|
|
|
tests/cases/conformance/types/members/classWithPrivateProperty.ts(18,18): error TS2341: Property 'c' is private and only accessible within class 'C'.
|
|
|
|
tests/cases/conformance/types/members/classWithPrivateProperty.ts(19,18): error TS2341: Property 'd' is private and only accessible within class 'C'.
|
|
|
|
tests/cases/conformance/types/members/classWithPrivateProperty.ts(20,18): error TS2341: Property 'e' is private and only accessible within class 'C'.
|
|
|
|
tests/cases/conformance/types/members/classWithPrivateProperty.ts(21,18): error TS2341: Property 'f' is private and only accessible within class 'C'.
|
|
|
|
tests/cases/conformance/types/members/classWithPrivateProperty.ts(22,18): error TS2341: Property 'g' is private and only accessible within class 'C'.
|
2014-09-12 22:35:07 +02:00
|
|
|
|
|
|
|
|
2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/conformance/types/members/classWithPrivateProperty.ts (8 errors) ====
|
|
|
|
// accessing any private outside the class is an error
|
|
|
|
|
|
|
|
class C {
|
|
|
|
private x;
|
|
|
|
private a = '';
|
|
|
|
private b: string = '';
|
|
|
|
private c() { return '' }
|
|
|
|
private d = () => '';
|
|
|
|
private static e;
|
|
|
|
private static f() { return '' }
|
|
|
|
private static g = () => '';
|
|
|
|
}
|
|
|
|
|
|
|
|
var c = new C();
|
|
|
|
var r1: string = c.x;
|
|
|
|
~~~
|
2014-09-19 15:37:55 +02:00
|
|
|
!!! error TS2341: Property 'x' is private and only accessible within class 'C'.
|
2014-07-13 01:04:16 +02:00
|
|
|
var r2: string = c.a;
|
|
|
|
~~~
|
2014-09-19 15:37:55 +02:00
|
|
|
!!! error TS2341: Property 'a' is private and only accessible within class 'C'.
|
2014-07-13 01:04:16 +02:00
|
|
|
var r3: string = c.b;
|
|
|
|
~~~
|
2014-09-19 15:37:55 +02:00
|
|
|
!!! error TS2341: Property 'b' is private and only accessible within class 'C'.
|
2014-07-13 01:04:16 +02:00
|
|
|
var r4: string = c.c();
|
|
|
|
~~~
|
2014-09-19 15:37:55 +02:00
|
|
|
!!! error TS2341: Property 'c' is private and only accessible within class 'C'.
|
2014-07-13 01:04:16 +02:00
|
|
|
var r5: string = c.d();
|
|
|
|
~~~
|
2014-09-19 15:37:55 +02:00
|
|
|
!!! error TS2341: Property 'd' is private and only accessible within class 'C'.
|
2014-07-13 01:04:16 +02:00
|
|
|
var r6: string = C.e;
|
|
|
|
~~~
|
2014-09-19 15:37:55 +02:00
|
|
|
!!! error TS2341: Property 'e' is private and only accessible within class 'C'.
|
2014-07-13 01:04:16 +02:00
|
|
|
var r7: string = C.f();
|
|
|
|
~~~
|
2014-09-19 15:37:55 +02:00
|
|
|
!!! error TS2341: Property 'f' is private and only accessible within class 'C'.
|
2014-07-13 01:04:16 +02:00
|
|
|
var r8: string = C.g();
|
|
|
|
~~~
|
2014-09-19 15:37:55 +02:00
|
|
|
!!! error TS2341: Property 'g' is private and only accessible within class 'C'.
|