25 lines
661 B
Plaintext
25 lines
661 B
Plaintext
==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorParameterProperties.ts (3 errors) ====
|
|
class C {
|
|
y: string;
|
|
constructor(private x: string) { }
|
|
}
|
|
|
|
var c: C;
|
|
var r = c.y;
|
|
var r2 = c.x; // error
|
|
~~~
|
|
!!! Property 'C.x' is inaccessible.
|
|
|
|
class D<T> {
|
|
y: T;
|
|
constructor(a: T, private x: T) { }
|
|
}
|
|
|
|
var d: D<string>;
|
|
var r = d.y;
|
|
var r2 = d.x; // error
|
|
~~~
|
|
!!! Property 'D.x' is inaccessible.
|
|
var r3 = d.a; // error
|
|
~
|
|
!!! Property 'a' does not exist on type 'D<string>'. |