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

39 lines
2.1 KiB
Plaintext
Raw Normal View History

2014-09-19 15:37:55 +02:00
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(8,10): error TS2341: Property 'x' is private and only accessible within class 'C'.
2014-09-19 23:01:07 +02:00
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(9,10): error TS2445: Property 'z' is protected and only accessible within class 'C' and its subclasses.
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(18,10): error TS2341: Property 'x' is private and only accessible within class 'D<T>'.
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(19,12): error TS2339: Property 'a' does not exist on type 'D<string>'.
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts(20,10): error TS2445: Property 'z' is protected and only accessible within class 'D<T>' and its subclasses.
2014-09-19 23:01:07 +02:00
==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts (5 errors) ====
2014-07-13 01:04:16 +02:00
class C {
y: string;
2014-09-19 23:01:07 +02:00
constructor(private x: string, protected z: string) { }
2014-07-13 01:04:16 +02:00
}
var c: C;
var r = c.y;
var r2 = c.x; // error
~~~
2014-09-19 15:37:55 +02:00
!!! error TS2341: Property 'x' is private and only accessible within class 'C'.
2014-09-19 23:01:07 +02:00
var r3 = c.z; // error
~~~
!!! error TS2445: Property 'z' is protected and only accessible within class 'C' and its subclasses.
2014-07-13 01:04:16 +02:00
class D<T> {
y: T;
2014-09-19 23:01:07 +02:00
constructor(a: T, private x: T, protected z: T) { }
2014-07-13 01:04:16 +02:00
}
var d: D<string>;
var r = d.y;
var r2 = d.x; // error
~~~
2014-09-19 15:37:55 +02:00
!!! error TS2341: Property 'x' is private and only accessible within class 'D<T>'.
2014-07-13 01:04:16 +02:00
var r3 = d.a; // error
~
2014-09-19 23:01:07 +02:00
!!! error TS2339: Property 'a' does not exist on type 'D<string>'.
var r4 = d.z; // error
~~~
!!! error TS2445: Property 'z' is protected and only accessible within class 'D<T>' and its subclasses.