This was we don't get noisy baselines just because a different phase of the compiler reported the diagnostic. This helps with Yui's refactoring work to move grammar checks into the type checker.
34 lines
No EOL
1.7 KiB
Text
34 lines
No EOL
1.7 KiB
Text
tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(4,5): error TS1089: 'private' modifier cannot appear on a constructor declaration.
|
|
tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(8,5): error TS2322: Type 'Function' is not assignable to type '() => void'.
|
|
tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(11,5): error TS1089: 'private' modifier cannot appear on a constructor declaration.
|
|
tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(12,5): error TS1089: 'private' modifier cannot appear on a constructor declaration.
|
|
tests/cases/conformance/types/members/typesWithPrivateConstructor.ts(15,10): error TS2346: Supplied parameters do not match any signature of call target.
|
|
|
|
|
|
==== tests/cases/conformance/types/members/typesWithPrivateConstructor.ts (5 errors) ====
|
|
// private constructors are not allowed
|
|
|
|
class C {
|
|
private constructor() { }
|
|
~~~~~~~
|
|
!!! error TS1089: 'private' modifier cannot appear on a constructor declaration.
|
|
}
|
|
|
|
var c = new C();
|
|
var r: () => void = c.constructor;
|
|
~
|
|
!!! error TS2322: Type 'Function' is not assignable to type '() => void'.
|
|
|
|
class C2 {
|
|
private constructor(x: number);
|
|
~~~~~~~
|
|
!!! error TS1089: 'private' modifier cannot appear on a constructor declaration.
|
|
private constructor(x: any) { }
|
|
~~~~~~~
|
|
!!! error TS1089: 'private' modifier cannot appear on a constructor declaration.
|
|
}
|
|
|
|
var c2 = new C2();
|
|
~~~~~~~~
|
|
!!! error TS2346: Supplied parameters do not match any signature of call target.
|
|
var r2: (x: number) => void = c2.constructor; |