Files
tsgo/testdata/baselines/reference/submodule/conformance/classConstructorAccessibility.errors.txt

49 lines
1.9 KiB
Plaintext

classConstructorAccessibility.ts(14,9): error TS2673: Constructor of class 'D' is private and only accessible within the class declaration.
classConstructorAccessibility.ts(15,9): error TS2674: Constructor of class 'E' is protected and only accessible within the class declaration.
classConstructorAccessibility.ts(31,13): error TS2673: Constructor of class 'D<T>' is private and only accessible within the class declaration.
classConstructorAccessibility.ts(32,13): error TS2674: Constructor of class 'E<T>' is protected and only accessible within the class declaration.
==== classConstructorAccessibility.ts (4 errors) ====
class C {
public constructor(public x: number) { }
}
class D {
private constructor(public x: number) { }
}
class E {
protected constructor(public x: number) { }
}
var c = new C(1);
var d = new D(1); // error
~~~~~~~~
!!! error TS2673: Constructor of class 'D' is private and only accessible within the class declaration.
var e = new E(1); // error
~~~~~~~~
!!! error TS2674: Constructor of class 'E' is protected and only accessible within the class declaration.
namespace Generic {
class C<T> {
public constructor(public x: T) { }
}
class D<T> {
private constructor(public x: T) { }
}
class E<T> {
protected constructor(public x: T) { }
}
var c = new C(1);
var d = new D(1); // error
~~~~~~~~
!!! error TS2673: Constructor of class 'D<T>' is private and only accessible within the class declaration.
var e = new E(1); // error
~~~~~~~~
!!! error TS2674: Constructor of class 'E<T>' is protected and only accessible within the class declaration.
}