|
1 | | -tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(6,5): error TS1089: 'private' modifier cannot appear on a constructor declaration. |
2 | | -tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(10,5): error TS1089: 'protected' modifier cannot appear on a constructor declaration. |
3 | | -tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(23,9): error TS1089: 'private' modifier cannot appear on a constructor declaration. |
4 | | -tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(27,9): error TS1089: 'protected' modifier cannot appear on a constructor declaration. |
| 1 | +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(15,9): error TS2673: Constructor of type '(x: number): D' is private and only accessible within class 'D'. |
| 2 | +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(16,9): error TS2674: Constructor of type '(x: number): E' is protected and only accessible within class 'E'. |
| 3 | +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(32,13): error TS2673: Constructor of type '<T>(x: T): D<T>' is private and only accessible within class 'D<T>'. |
| 4 | +tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(33,13): error TS2674: Constructor of type '<T>(x: T): E<T>' is protected and only accessible within class 'E<T>'. |
5 | 5 |
|
6 | 6 |
|
7 | 7 | ==== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts (4 errors) ==== |
| 8 | + |
8 | 9 | class C { |
9 | 10 | public constructor(public x: number) { } |
10 | 11 | } |
11 | 12 |
|
12 | 13 | class D { |
13 | | - private constructor(public x: number) { } // error |
14 | | - ~~~~~~~ |
15 | | -!!! error TS1089: 'private' modifier cannot appear on a constructor declaration. |
| 14 | + private constructor(public x: number) { } |
16 | 15 | } |
17 | 16 |
|
18 | 17 | class E { |
19 | | - protected constructor(public x: number) { } // error |
20 | | - ~~~~~~~~~ |
21 | | -!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration. |
| 18 | + protected constructor(public x: number) { } |
22 | 19 | } |
23 | 20 |
|
24 | 21 | var c = new C(1); |
25 | | - var d = new D(1); |
26 | | - var e = new E(1); |
| 22 | + var d = new D(1); // error |
| 23 | + ~~~~~~~~ |
| 24 | +!!! error TS2673: Constructor of type '(x: number): D' is private and only accessible within class 'D'. |
| 25 | + var e = new E(1); // error |
| 26 | + ~~~~~~~~ |
| 27 | +!!! error TS2674: Constructor of type '(x: number): E' is protected and only accessible within class 'E'. |
27 | 28 |
|
28 | 29 | module Generic { |
29 | 30 | class C<T> { |
30 | 31 | public constructor(public x: T) { } |
31 | 32 | } |
32 | 33 |
|
33 | 34 | class D<T> { |
34 | | - private constructor(public x: T) { } // error |
35 | | - ~~~~~~~ |
36 | | -!!! error TS1089: 'private' modifier cannot appear on a constructor declaration. |
| 35 | + private constructor(public x: T) { } |
37 | 36 | } |
38 | 37 |
|
39 | 38 | class E<T> { |
40 | | - protected constructor(public x: T) { } // error |
41 | | - ~~~~~~~~~ |
42 | | -!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration. |
| 39 | + protected constructor(public x: T) { } |
43 | 40 | } |
44 | 41 |
|
45 | 42 | var c = new C(1); |
46 | | - var d = new D(1); |
47 | | - var e = new E(1); |
| 43 | + var d = new D(1); // error |
| 44 | + ~~~~~~~~ |
| 45 | +!!! error TS2673: Constructor of type '<T>(x: T): D<T>' is private and only accessible within class 'D<T>'. |
| 46 | + var e = new E(1); // error |
| 47 | + ~~~~~~~~ |
| 48 | +!!! error TS2674: Constructor of type '<T>(x: T): E<T>' is protected and only accessible within class 'E<T>'. |
48 | 49 | } |
49 | 50 |
|
0 commit comments