49 lines
No EOL
1.9 KiB
Text
49 lines
No EOL
1.9 KiB
Text
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(6,5): error TS1089: 'private' modifier cannot appear on a constructor declaration.
|
|
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(10,5): error TS1089: 'protected' modifier cannot appear on a constructor declaration.
|
|
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(23,9): error TS1089: 'private' modifier cannot appear on a constructor declaration.
|
|
tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts(27,9): error TS1089: 'protected' modifier cannot appear on a constructor declaration.
|
|
|
|
|
|
==== tests/cases/conformance/classes/constructorDeclarations/classConstructorAccessibility.ts (4 errors) ====
|
|
class C {
|
|
public constructor(public x: number) { }
|
|
}
|
|
|
|
class D {
|
|
private constructor(public x: number) { } // error
|
|
~~~~~~~
|
|
!!! error TS1089: 'private' modifier cannot appear on a constructor declaration.
|
|
}
|
|
|
|
class E {
|
|
protected constructor(public x: number) { } // error
|
|
~~~~~~~~~
|
|
!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration.
|
|
}
|
|
|
|
var c = new C(1);
|
|
var d = new D(1);
|
|
var e = new E(1);
|
|
|
|
module Generic {
|
|
class C<T> {
|
|
public constructor(public x: T) { }
|
|
}
|
|
|
|
class D<T> {
|
|
private constructor(public x: T) { } // error
|
|
~~~~~~~
|
|
!!! error TS1089: 'private' modifier cannot appear on a constructor declaration.
|
|
}
|
|
|
|
class E<T> {
|
|
protected constructor(public x: T) { } // error
|
|
~~~~~~~~~
|
|
!!! error TS1089: 'protected' modifier cannot appear on a constructor declaration.
|
|
}
|
|
|
|
var c = new C(1);
|
|
var d = new D(1);
|
|
var e = new E(1);
|
|
}
|
|
|